On Wed, May 2, 2018 at 2:48 AM, Hugh Fisher <hugo.fis...@gmail.com> wrote:
>
> On Tuesday, May 1, 2018 at 10:45:30 PM UTC+10, Ian Lance Taylor wrote:
>>
>>
>> A `while` statement would presumably be exactly identical to a `for`
>> statement with a single condition.  So adding a `while` statement
>> would not add any power to the language, and would add an additional
>> keyword.  All language choices are a cost benefit decision.  In this
>> case the benefit is a looping construct that some people will find
>> clearer to read and write, and the cost is a new keyword that
>> everybody needs to learn, and that at this point in the language's
>> evolution will likely break some, even if not much, existing code.  I
>> don't think the benefit is worth the cost.
>>
> As for not adding any power, that's why I mentioned if-then-else and switch.
> Switch with boolean cases is the same as if then else. It's not an obscure
> side effect either, the Go Tour cheerfully explains how to use it instead of
> if-then-else if you prefer.

That is not the same thing, though.  Yes, if-then-else and switch do
similar things, but they have a different syntax and are idiomatically
used in different ways.  You can consider if-then-else as syntactic
sugar for switch, if you like.  It's OK for a language to have some
syntactic sugar.

But in this case you seem to be suggesting that we add `while <cond> {
<body> }` as an exact duplicate of the existing language construct
`for <cond> { <body> }`.  That's not syntactic sugar.  You are
suggesting that `while` just be a synonym for `for`.  We don't need
two different keywords that mean exactly the same thing.


> Hmm, think I will have a look at the formal change proposal process...

I encourage proposals but I can tell you upfront that this proposal
will not be accepted.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to