Indeed!
Go has while loops :)
for {
// do some stuff
if !condition { break }
}
instead of
{
// do some stuff
} while condition
They are identical functionally, so why bother with the second syntax? You
then get into arguments about which one to use.
-- Marcin
On Tue, Nov 3, 2020 at
Languages often have a whole variety of loop constructs.
C has for loops as well us while loops.
Go adopts the principle from the Zen of python:
*There should be one-- and preferably only one --obvious way to do it. *It
takes a minimalist approach - there is only one looping construct: the for
On Tue, Nov 3, 2020 at 6:09 AM 'Dan Kortschak' via golang-nuts
wrote:
> My first professional programming language was Perl, decades later I
> still wake up in a sweat thinking about post-fix conditionals and the
> 'unless' conditional.
I don't miss MUMPS post conditional either.
--
You
Thanks, Dan. Those seem like well-reasoned points.
On Mon, Nov 2, 2020 at 9:33 PM 'Dan Kortschak' via golang-nuts <
golang-nuts@googlegroups.com> wrote:
> There are two parts. The worse part is the negative conditional
> (unless), which has the problem that humans are bad at negations;
> nearly
There are two parts. The worse part is the negative conditional
(unless), which has the problem that humans are bad at negations;
nearly always when there is a complex condition with an "unless", it
needs to be mentally refactored into an "if !" (when working through
other people's bugs, I
I don't think I'm personally sold on this proposal either, but I'm curious
what bad experiences you've had with post-fix conditionals. I haven't
personally used a language with post-fix conditionals and it sounds like
that might be to my benefit :)
On Mon, Nov 2, 2020 at 9:09 PM 'Dan Kortschak'
My first professional programming language was Perl, decades later I
still wake up in a sweat thinking about post-fix conditionals and the
'unless' conditional.
Please no.
On Mon, 2020-11-02 at 14:26 -0800, Jeffrey Paul wrote:
> Hello Gophers,
>
> There's two tiny pieces of syntactic sugar I
Hello Gophers,
There's two tiny pieces of syntactic sugar I really miss from a few other
languages that I think would add a nice bit of ergonomics and convenience to Go
(which I now play as my main) without increasing any magic or spooky action at
a distance.
They are:
- postfix conditionals