[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ternary operator patch
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 16 Sep 2010 09:46:30 +0200
On Thu, Sep 16, 2010 at 9:40 AM, Jeff Pohlmeyer
<yetanothergeek@gmail.com> wrote:
> pseudo?
>
> function choose(expr,yes,no)
> if expr then return yes else return no end
> end
That's a function I've written a number of times, but it does evaluate
both yes and no, whether needed or not - a fine idiom for picking one
of two strings or numbers, etc.
I call it 'pseudo' because it would be part of the grammar - only way
one could get that late evaluation. At least there would be no
arguments about precedence...
steve d.
- References:
- Re: Ternary operator patch, steve donovan
- Re: Ternary operator patch, Henk Boom
- 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