News for hackers. Stuff that matters.
Re:Warming up to Go by bkeroack on Saturday September 12, 2015 @11:23AM (#10208323)
Go is a little more verbose in basically two ways: it forces you to handle error states explicitly, and it doesn't let you do overly-clever things to save a few lines of typing. Neither of which increase the maintenance or testing burden.
Re:Warming up to Go by lmm on Saturday September 12, 2015 @01:23PM (#10208632)
Programming consists entirely of doing overly-clever things to save a few lines of typing. Go belongs to the same school of ludditery as von Neumann's opposition to assembly.
Re:Warming up to Go by jacques_chester on Saturday September 12, 2015 @11:26AM (#10208329)
> it forces you to handle error states explicitly,

Does it?

`if err != nil` is a convention. It's not a checked error. It's like saying "C has explicit array bounds checking", if the convention was to check it by hand.

For all the hate Java gets, when I have a checked exception, I know what it is going to be. I don't need to dig around in sourcecode trying to work out if I should care or not. I don't need to check which of the three Golang error-distinction idioms (package-variable errors, error subtypes, plain-old-errors-with-magical-strings) is in play.

As you can guess, I don't like Go.

Re:Warming up to Go by sagichmal on Saturday September 12, 2015 @12:33PM (#10208489)
> `if err != nil` is a convention. It's not a checked error.

It's... obviously both.

Re:Warming up to Go by jacques_chester on Saturday September 12, 2015 @12:43PM (#10208531)
Sorry, typo. "Checked exception", meaning that the compiler enforces error handling and that you can look a method signature and learn what kind of exceptions the method can throw without needing to read its internals.
Re:Warming up to Go by superuser2 on Saturday September 12, 2015 @02:53PM (#10208912)
'err' is sitting there in the return value and the compiler will force you to either use it or explicitly steamroll it. The difference between C bounds checking and Go error checking is that you can't forget to check an error in Go.
Re:Warming up to Go by azth on Sunday September 13, 2015 @04:29AM (#10210710)
I guess everyone is remembering to check the return values of fmt.Println() then huh?
Re:Warming up to Go by fooster on Saturday September 12, 2015 @12:43PM (#10208526)
And runtime exceptions? What about them?
Re:Warming up to Go by jacques_chester on Saturday September 12, 2015 @12:46PM (#10208538)
They leave you in about the same position as a programmer in a dynamic language.

The advantage of runtime exceptions over Go is that I will get a fatal crash and a stacktrace. I don't have computation proceeding in an undefined, difficult-to-debug way because I forgot to do `err != nil` somewhere (particularly for functions that only return err).

Re:Warming up to Go by fooster on Saturday September 12, 2015 @05:54PM (#10209514)
Or someone will catch it and discard the result which is often often what occurs. For example, with java throw an exception in an executor task (an assertion failure for example). What do you think occurs?
Re:Warming up to Go by jacques_chester on Sunday September 13, 2015 @07:34AM (#10211030)
Which happens in Go too. I've seen a lot of code that happily sails past functions which only return err, meaning the compiler never pipes up.

Don't get me wrong, though. I become grumpy when I see empty catch clauses. Or a logger figleaf.

Re:Warming up to Go by MichaelGG on Saturday September 12, 2015 @02:47PM (#10208901)
>doesn't let you do overly-clever things to save a few lines of typing

So that's what we're calling the lack of HoFs these days? It's really sad to hear that anyone considers map/fold/filter are "overly-clever".

Tim Sweeney (Epic) says[1]:

"“For” loops in Unreal:

40% are functional comprehensions

50% are functional folds"

I hardly see how changing those loops into a construct that more accurately represents them is overly-clever.

1: http://www.cs.princeton.edu/~dpw/popl/06/Tim-POPL.ppt

Re:Warming up to Go by burntsushi on Saturday September 12, 2015 @02:59PM (#10208932)
> So that's what we're calling the lack of HoFs these days?

Go has HoFs. The lack of parametric polymorphism is what prevents you from writing `map` in Go (subject to several caveats surrounding efficiency and type safety).

Re:Warming up to Go by MichaelGG on Saturday September 12, 2015 @04:16PM (#10209197)
In practise I don't find passing function parameters without generics to be very useful.
Re:Warming up to Go by pcwalton on Saturday September 12, 2015 @12:45PM (#10208534)
> Go is a little more verbose in basically two ways: it forces you to handle error states explicitly

No, it doesn't (simple example: the return value of os.Setenv). errcheck exists for a reason.