We already have ifelse as the ternary function. If the function form has different evaluation rules than the operator form, then it ought to have a different name.
On Mon, Jun 16, 2014 at 12:34 PM, TR NS <[email protected]> wrote: > > > On Sunday, June 15, 2014 9:33:32 PM UTC-4, Jacob Quinn wrote: >> >> Yeah, I feel kind of torn on this on. >> >> On the one hand, I've kind of grown used to the `is...` method naming >> convention and it has nice discoverability properties (tab-completion) and >> isn't generally too awkward (though double s's are sometimes weird >> `issubset` `issubtype`, and it took me a while to figure out isa() => is a). >> >> The syntax-hungry beast in me though loves the handiness of adding a `?` >> to boolean methods. At this point, it's probably not worth the change, and >> my main concern would be combining it with the ternary operator: >> >> result = good?(x) ? good : bad >> >> The double `?` would probably get real old real fast. >> > > As a long time Rubyist, I concur that the double `?` from ternary operator > has always been a little annoying. On the other hand the readability of > `?`-suffixed predicate methods has easily outweighed the downside of this > one usage. And in Julia at least you have a `()` in between. In Ruby you > don't even have that. Valid Ruby: > > result = good? ? good : bad > > The Julia equivalent of > > result = good?() ? good : bad > > isn't so bad. > > And if I might add a small aside, ternary as an honest to god function: > > result = ?(good?(), good, bad) > > >
