[stringtemplate-interest] Fail on undefined property
Terence Parr
parrt at cs.usfca.edu
Mon Aug 3 11:50:01 PDT 2009
it's very convenient to show a value if it's present without
throwing an error. I will make an option in the next version.
T
On Aug 3, 2009, at 2:44 AM, Koerner, Ron wrote:
> Would a functionality like "fail generation of template if some
> variables are undefined" not violate model/view separation?
>
> Actually the model generation should fail and make the decision
> whether
> something is displayable or not.
>
> Regards,
> Ron
>
> -----Original Message-----
> From: stringtemplate-interest-bounces at antlr.org
> [mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of
> Terence
> Parr
> Sent: Friday, July 31, 2009 10:13 PM
> To: John D. Mitchell
> Cc: String Template
> Subject: Re: [stringtemplate-interest] Fail on undefined property
>
> Yeah, I hear that. On the other hand, we already have syntax for this
>
> <x> is mandatory
> <if(x)><x><endif> is not mandatory
>
> verbose, but functionality already exists ;)
>
> T
> On Jul 31, 2009, at 1:11 PM, John D. Mitchell wrote:
>
>> On Jul 31, 2009, at 13:02 , Terence Parr wrote:
>>> On Jul 31, 2009, at 1:01 PM, John D. Mitchell wrote:
>>>> I haven't followed this thread too closely but in terms of
>>>> optionality, one trick would be to add syntactic support for
>>>> something like:
>>>> <x?> or <x!>
>>>
>>> that could work but I would prefer to have it on the parameter
>>> definitions not the usage:
>>>
>>> mytemplate(firstname, lastname?) ::= "..."
>>
>> FWIW, I'm more on the side of "at the point of usage" because I
>> think having the fact be very explicit is a good thing. I.e., when
>> one is reading through the template, having it jump out as different
>> behavior is helpful -- having the same looking thing with two
>> different behaviors just bothers me, I guess.
>>
>> Hope this helps,
>> John
>>
>>
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>
> --
> WINCOR NIXDORF International GmbH
> Sitz der Gesellschaft: Paderborn
> Registergericht Paderborn HRB 3507
> Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach,
> Dr. Jürgen Wunram
> Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
> Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-
> Nr. DE44477193
>
> Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der
> richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
> informieren Sie bitte sofort den Absender und vernichten Sie diese E-
> Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser
> E-Mail ist nicht gestattet.
>
> This e-mail may contain confidential information. If you are not the
> intended recipient (or have received this e-mail in error) please
> notify the sender immediately and destroy this e-mail. Any
> unauthorised copying, disclosure or distribution of the material in
> this e-mail is strictly forbidden.
>
More information about the stringtemplate-interest
mailing list