Yes, exactly, I was imagining it as a sugar for `4 == 2+2 ? go_home() : nothing`. I'm liking this more the more I think about it.
Amazingly, Julia passes all tests after adding `then` to the reserved words list in julia-syntax.scm. Of course, it should probably be deprecated as an identifier for a full cycle first. On Friday, March 21, 2014 10:17:15 PM UTC-4, Chris Foster wrote: > > Given the similarity in syntax, I'd expect it to behave the same as a > normal if ... end > > On Sat, Mar 22, 2014 at 12:05 PM, Jacob Quinn > <[email protected]<javascript:>> > wrote: > > What would return from the statement if it were false? nothing? Like if > I > > use it assigning a variable? I definitely see the attraction as a one > liner > > though. > > > > -Jacob > > > > On Mar 21, 2014 9:52 PM, "Chris Foster" <[email protected] <javascript:>> > wrote: > >> > >> On Sat, Mar 22, 2014 at 9:23 AM, Stefan Karpinski > >> <[email protected]<javascript:>> > > >> wrote: > >> > I kind of like that idea, actually. > >> > > >> > On Fri, Mar 21, 2014 at 5:10 PM, Matt Bauman > >> > <[email protected]<javascript:>> > wrote: > >> >> > >> >> I quickly acclimated to Stefan's && idiom and now happily read and > >> >> write > >> >> code containing it. That said, it did throw me for a loop when > first > >> >> learning the language. I'm not too big of a fan of reserving > another > >> >> keyword for an optional syntax... but I could perhaps support its > >> >> inclusion if > >> >> it were *only* for one-line if statements and didn't require a > >> >> terminating > >> >> `end` (and had no support for else/elseif clauses): > >> > >> +1 I've no personal problem with the idiomatic version using && but > >> in the interests of making compact code which is also readable by new > >> users I think this would be a good step. It's great to not have to > >> trade off legibility against compactness. >
