[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: block return semantic
- From: Reuben Thomas <rrt@...>
- Date: Wed, 27 Jun 2001 16:14:42 +0100 (BST)
> Could you elaborate on the "all sorts of reasons" for not allowing
> if-then-else as an expression rather than just a statement?
The sort of thing that's been discussed before: it might be nice, but it
would have compatibility implications (especially because of Lua's optional
statement terminators), efficiency implications; it would complicate the
language &c. This argument has already been had (with me as a proponent of a
more functional Lua!) on the list a few times.
> is allowed. I find it quite useful for handling default values for
> uninitialized variables
You can use the "a = f(x) or d" trick for this
> Note that an alternative approach would be to implement a special
> expression version of if-then-else such as Java's <cond> ? <exp1> :
> <exp2> form.
I'd prefer a more functional Lua rather than a special case.
http://sc3d.org/rrt/ | Academics age by degrees