[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ternary operator patch
- From: David Kastrup <dak@...>
- Date: Thu, 16 Sep 2010 18:44:32 +0200
Tomas Guisasola Gorham <tomas@tecgraf.puc-rio.br> writes:
> 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])...
[...]
It would appear that Lua's clean syntax appeals to language improvers
like a clean wall to graffiti sprayers.
--
David Kastrup
- References:
- 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
- Re: Ternary operator patch, Tomas Guisasola Gorham