[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ternary operator patch
- From: Tomas Guisasola Gorham <tomas@...>
- Date: Thu, 16 Sep 2010 13:20:07 -0300 (BRT)
Hi Eric
I think this is not a good feature since it is not clear to the
caller whether the expressions will be both evaluated or not. Michal
Kottman already provided a better example:
http://permalink.gmane.org/gmane.comp.lang.lua.general/68820
z = choose(y~=0, [x/y], [0])
IMO this is more clear than
z = choose(y~=0, || x/y, || 0)
Well, I think both are cryptic. We are used to associate
`t[i]' with the i-th element inside t, but this is just a convention.
But would it conflict with the array indexing operator i.e the brackets in
"myarray[5]"?
Yes, and since f"..." and f{...} are shortcuts for function calls,
one could wonder that f[x/y] become shortcut for f([x/y])...
For the case of a function definition, I think the most important
is to make the body limits very clear. However, since Lua does not
define these limits with single characters, but with words (end), the
solution will be incoherent with the rest of the language... We can
think of a combination of characters such as \( and \) but I think it
would lead to more cumbersome and cryptic text...
Regards,
Tomás
- References:
- Re: Ternary operator patch, steve donovan
- Re: Ternary operator patch, steve donovan
- Re: Ternary operator patch, Geoff Leyland
- Re: Ternary operator patch, steve donovan
- Re: Ternary operator patch, Miles Bader
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Miles Bader
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Jonathan Castello
- Re: Ternary operator patch, Roberto Ierusalimschy
- Re: Ternary operator patch, Alexander Gladysh
- Re: Ternary operator patch, steve donovan
- Re: Ternary operator patch, Jeff Pohlmeyer
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Michal Kolodziejczyk
- Re: Ternary operator patch, Michal Kottman
- Re: Ternary operator patch, Eric Man
- Re: Ternary operator patch, Tomas Guisasola Gorham
- Re: Ternary operator patch, Eric Man