[stringtemplate-interest] do we need null?
sharwell at pixelminegames.com
Sun Apr 10 17:37:59 PDT 2011
Null and an empty collection (no items) are equivalent. Null and empty
string are equivalent on output, but different if you use them in a test.
However, for cases where your template plans to test a value, it's easy to
make it a true/false parameter instead of a string.
In my ST3 templates, there were *many* places where I wished there were a
null value. With the added Boolean literals in ST4, every last one of them
was immediately resolved.
From: stringtemplate-interest-bounces at antlr.org
[mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of Barrie
Sent: Sunday, April 10, 2011 6:53 PM
To: Terence Parr
Cc: stringtemplate-interest List
Subject: Re: [stringtemplate-interest] do we need null?
On Mon, Apr 11, 2011 at 8:25 AM, Terence Parr <parrt at cs.usfca.edu> wrote:
> I'm calling a template that takes an argument but I don't have a value for
it. That's fine except that at runtime it warns me that I haven't passed
enough parameters. I guess I could pass in "", what should we introduce the
notion of null? Hmm... maybe it's not worth the extra concept. We have
true, false, and empty string.
How would null render?
Isn't empty string usually what you want for a "null" value anyway.
stringtemplate-interest mailing list
stringtemplate-interest at antlr.org
More information about the stringtemplate-interest