StubbleOrg / Stubble

Trimmed down {{mustache}} templates in .NET
Other
406 stars 58 forks source link

Namespace Class Clash #4

Closed thornley-touchstar closed 9 years ago

thornley-touchstar commented 9 years ago

Would it make sense to change the name of the main stubble class (and interface) to StubbleRenderer?

I noticed that the class name clashes with the root namespace (Stubble.Core.Stubble) so references to the class need to be fully qualified. Your tests don't have this problem because they all exist in Stubble.Core.Tests.

So for a simple contrived example: -

using System;

using Stubble.Core;

namespace StubbleTest
{
    class MainClass
    {
        public static void Main (string[] args)
        {               
            var stubble = new Stubble();
            var output = stubble.Render("{{Foo}}", new { Foo = "Bar" });
            Console.WriteLine("Output[" + output + "]");
        }
    }
}

You get the compiler error: -

Error CS0118: 'Stubble' is a 'namespace' but a 'type' was expected (CS0118) (StubbleTest)

On the other hand, maybe I am missing something obvious...

Romanx commented 9 years ago

Hey there,

This is a good point and exactly why Stubble is still in alpha, thank you for trying it out and spotting this. I'll have a look at changing the name-spacing to be something less conflicting to hopefully resolve this issue.

Romanx commented 9 years ago

Hi there,

I had a look at this, this evening and it is not a good experience. After some thinking and tweaking I decided to go with your suggestion and update the naming of the following classes/interfaces:

I should be pushing a new build to nuget.org as Alpha 8 in the next few minutes and updating the Extension libraries and pushing them also.

Thank you for your contribution and if you have any other questions, suggestions or general feedback feel free to open an issue.

thornley-touchstar commented 9 years ago

Great, thanks for the fast turnaround :)