[go-nuts] Re: if/switch statements as expressions

2019-01-12 Thread Lucio
On Sunday, 13 January 2019 01:40:14 UTC+2, David Collier-Brown wrote: > > [ ... ] > Anyone here remember how algol68 addressed that, or what the hollering was > about? > > It's too easy, forty years later, to label algol68 a success. From my very remote location and no social media at the time,

[go-nuts] Re: if/switch statements as expressions

2019-01-12 Thread Lucio
On Saturday, 12 January 2019 13:04:32 UTC+2, alanfo wrote: > > Sorry for the delay in responding. > > [ ... ] > > Such cases crop up a lot in practice and I don't think I'm the only one > who finds it tedious having to write six lines of code when a single line > suffices in most other C-family l

[go-nuts] Re: if/switch statements as expressions

2019-01-12 Thread David Collier-Brown
Very *very* regular languages like lisp barely made a distinction between expressions and statements, so if was an expression. I'm not sure how well that would work in a c-like language like Go: the debate about that in algol68 was about 8 years before I became interested in computers. Anyone

[go-nuts] Re: if/switch statements as expressions

2019-01-12 Thread alanfo
Sorry for the delay in responding. Yes, that's a fair point though I was only intending the Iif function to be used for simple cases where the cost of evaluating both expressions is negligible. Such cases crop up a lot in practice and I don't think I'm the only one who finds it tedious having

Re: [go-nuts] Re: if/switch statements as expressions

2019-01-03 Thread Michael Jones
yes. lisp was early (first?) to support unevaluated arguments via hold and other mechanisms. quite useful for this situation. On Thu, Jan 3, 2019 at 3:33 PM Milan Zamazal wrote: > alanfo writes: > > > Some languages which don't support the conditional operator or if/else > > expressions have an

[go-nuts] Re: if/switch statements as expressions

2019-01-03 Thread Milan Zamazal
alanfo writes: > Some languages which don't support the conditional operator or if/else > expressions have an Iif function (or similar) instead. > > If generics are added to Go, it might be worth including something like > this in the standard library to cut down on boilerplate for simple cases

Re: [go-nuts] Re: if/switch statements as expressions

2018-12-21 Thread Mark Volkmann
I would sure like to see something like that! On Fri, Dec 21, 2018 at 12:06 PM alanfo wrote: > Some languages which don't support the conditional operator or if/else > expressions have an Iif function (or similar) instead. > > If generics are added to Go, it might be worth including something li

[go-nuts] Re: if/switch statements as expressions

2018-12-21 Thread alanfo
Some languages which don't support the conditional operator or if/else expressions have an Iif function (or similar) instead. If generics are added to Go, it might be worth including something like this in the standard library to cut down on boilerplate for simple cases: // in a package called