[slang-users] Re: slang 2.2.0 release candidate 1 available
John E. Davis
davis at space.mit.edu
Tue Jul 21 15:11:37 UTC 2009
Jörg Sommer <joerg at alea.gnuu.de> wrote:
> Can you extend this expression to evaluate to condition if val1 isn't
> present? I find it very helpful to write
>
> exp = container.get(10) ? : default_object
>
> instead of
>
> exp = container.get(10) != NULL ? container.get(10) : default_object
I do not want to add any new features to 2.2.0, but I will consider
this for 2.2.1.
FWIW, here is an ugly hack that mimics the above:
exp = (container.get(10), dup()) ? () : (pop(), default_object);
Note that NULL evaluates to 0 in a boolean context.
Thanks,
--John
More information about the slang-users-l
mailing list