[stringtemplate-interest] v4 model adaptor unit tests
Terence Parr
parrt at cs.usfca.edu
Thu Dec 23 17:52:14 PST 2010
Well it's an error if a.prop doesn't exist I think. being null is ok though so
<if(a.children)>...<endif>
works w/o throwing an exception. but if children is not a valid field or method addressed by a model, it's a programming error I think. I'm a bit tired at moment though so I'm happy to consider some use cases if you can pass 'em along.
Ter
On Dec 23, 2010, at 5:45 PM, Rafael Chaves wrote:
> It seems the way an adaptor passes up the opportunity to address a
> property is by throwing an exception. Is that correct, or does the
> exception signals a real error and aborts property resolution? It was
> not clear from the test cases as both adaptors handle the exact same
> properties.
>
> If that is correct, doesn't throwing exceptions for the majority of
> properties being resolved (which in the normal case would be handled
> by the default ObjectModelAdaptor) create a lot of unnecessary
> objects?
>
> I handled the case of not understanding a property by returning null,
> but that does not allow actually returning null as the intended value.
> Could be returning some other object (a DOES_NOT_UNDERSTAND string
> constant, for instance) instead.
>
> Cheers,
>
> Rafael
>
> On Thu, Dec 23, 2010 at 5:24 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
>> http://www.stringtemplate.org/depot/ST4/java/main/test/org/stringtemplate/v4/test/TestModelAdaptors.java
>> in case you want to look. (374 tests overall)
>> Ter
>> _______________________________________________
>> stringtemplate-interest mailing list
>> 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