News for hackers. Stuff that matters.
Re:Golang: Know Your 'Nil' by tsimionescu on Tuesday March 30, 2021 @03:41PM (#26639383)
I don't think I know of a single thing where there are fewer ways of doing something in Go than there are in Java.

There are multiple ways to declare a variable, to pass a value to a function, to declare a constant, to create something similar to an enum, to return errors, to check for errors, to handle closing, to synchronize parallel threads of execution, to initialize a struct, to create a list of items. I can probably go on.

What are some examples where Go is simpler than Java, other than its current lack of generics which has always been a known-limitation?

Re:Golang: Know Your 'Nil' by sagichmal on Tuesday March 30, 2021 @08:09PM (#26642077)
There is one way to iterate over things, for any kind of elementwise processing: a `for` loop.

There is one way to format your code ;)

Re:Golang: Know Your 'Nil' by tsimionescu on Wednesday March 31, 2021 @01:06AM (#26643725)
There are still two ways: the C-style for loop and its variants (for initializer; condition; increment) and the range for loop with its variants (iterate by key, by value, or both). There's also the option of writing a recrusive function.

Still less than Java's five (do-while, while, C-style for, range for, recursion), to be fair.