[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: default values of 'false' in data description
- From: Bret Victor <bret@...>
- Date: Fri, 15 Sep 2006 05:38:02 +0000 (UTC)
Mark Hamburg <mhamburg <at> adobe.com> writes:
> A 5.2 request: It would be nice to have a mechanism/idiom to replace the
> x or y
> idiom in cases where we want y if x is nil but not if x is false.
Incidentally, that was one of the earliest features
added to Perl 6:
a || b (returns b if a is 0, "", or undef)
a // b (returns b if a is undef)
I constantly feel the need for this when writing Perl.
But in Lua, the issue almost never comes up, mostly
because Lua thinks that 0 and "" are true. Which is
wonderful, once you get used to it.