[go-nuts] Re: Ternary operator needed in Go

2017-10-16 Thread john howitt
No! no! please no! -- runs screaming from the room On Wednesday, December 23, 2009 at 5:09:24 PM UTC, abiosoft wrote: > > I think there is need for ternary operator for neater codes. > > if a > b { >c = a > else { > c = b > } > > can easily be written as > > c = a > b ? a : b > > I think the

Re: [go-nuts] Re: Ternary operator needed in Go

2017-10-15 Thread matti . dahlbom
In addition (or instead of) the ternary operator; I would very much like to see an operator like: Python's OR for selecting a non-None value: foo = bar or baz Swift's ?? operator for using a value if non-nil or otherwise another value: foo = bar ?? "default" -- You received this message beca

Re: [go-nuts] Re: Ternary operator needed in Go

2017-10-15 Thread Ian Lance Taylor
On Sat, Oct 14, 2017 at 11:50 PM, wrote: > > In addition (or instead of) the ternary operator; I would very much like to > see an operator like: > > Python's OR for selecting a non-None value: > > foo = bar or baz > > Swift's ?? operator for using a value if non-nil or otherwise another value: >

Re: [go-nuts] Re: Ternary operator needed in Go

2017-10-16 Thread Christopher
Python resisted this for a while, depending on it's OR behavior. However, the OR behavior has a lot of critics and criticisms. See https://www.python.org/dev/peps/pep-0308/ The if expression is really nice, and quite clear. I use it a lot. It doesn't require null types or other exotic feature

Re: [go-nuts] Re: Ternary operator needed in Go

2017-10-16 Thread Dave Cheney
Prior to this recent post, this thread had been dormant for eight years. I think the results speak for themselves and this topic does not need to be revisited again. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this grou

Re: [go-nuts] Re: Ternary operator needed in Go

2017-10-18 Thread Nicolas Grilly
On Monday, October 16, 2017 at 8:37:25 PM UTC+2, Dave Cheney wrote: > > Prior to this recent post, this thread had been dormant for eight years. I > think the results speak for themselves and this topic does not need to be > revisited again. At least, it proves people are searching in the maili

Re: [go-nuts] Re: Ternary operator needed in Go

2017-10-18 Thread Jesper Louis Andersen
If a language has two syntactic classes, statements and expressions, then having a choice operator in both seems somewhat redundant and bounds for confusion. If on the other hand, your language only has expressions, then there is only a single choice operator, and this whole thing doesn't matter.