[stringtemplate-interest] feature request: attribute name as enum
Sam Barnett-Cormack
s.barnett-cormack at lancaster.ac.uk
Mon Dec 5 00:17:04 PST 2011
As an *optional* tool that could be brilliant. It would be especially
useful if it were combined with the return of group interfaces - this
time with a truly useful nature of allowing code polymorphism when it
comes to these interfaces. This could be incredibly useful for the
project I'm (slowly) working on.
Sam
On 04/12/2011 23:47, Terence Parr wrote:
> An interesting thought. is this so that you could get some compile time
> warnings if you type in the wrong attribute name? how would you
> coordinate the enum constants with the attributes defined in the
> template file? Actually, maybe that could be automatically generated by
> a tool that looks at ST files and generates in enums?
>
> If we take this a step further, perhaps there should be a tool that
> looks at templates and generates interfaces for them so that we can
> create them directly with constructors and typed attributes?
>
> Instead of getInstanceOf("foo") and then st.add("x", 34); we could do:
>
> new foo(34);
>
> from:
>
> foo(x) ::= "value: <x>"
>
> Interesting. What do other people think?
>
> Ter
> On Sep 16, 2011, at 2:07 AM, AuFinNS wrote:
>
>> Hello,
>>
>> is it suitable to have an stringtemplate add method with signature
>>
>> public ST add(Enum<?> name, java.lang.Object value) {
>> return add(name.name(), value);
>> }
>>
>> for easy work with enums?
>>
>> Many thanks!
>> Best Regards, Max
>>
>>
>>
>> _______________________________________________
>> stringtemplate-interest mailing list
>> stringtemplate-interest at antlr.org
>> <mailto:stringtemplate-interest at antlr.org>
>> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>
>
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list