by fingerprinter · 14y ago · 0 comments
I honestly can't tell if he is trolling or if he is serious.
I don't think he's trolling, but I do think he's playing to C's strengths and Go's weaknesses, possibly by accident.
It is ironic that their motivation is to tame and restrict the use of exceptions, and then they replace them by something even richer and much less structured. I fail to see any pros of this proposal. It seems mostly equivalent to exceptions, i.e., you can easily express raise/try/finally as syntactic sugar, and likely the other way round. But it is (1) much more ad-hoc -- you cannot give a simple reduction semantics for this, (2) much less orthogonal -- tying `defer' in with function definitions, (3) dependent on mutation -- for recovering and returning alternative results, and implicitly in the semantics of `defer'. One consequence is the loss of beta-convertibility, which means that you as a programmer cannot take an arbitrary piece of code and turn it into a function anymore, or vice versa, eliminate a function by inlining its body. Such abstractions/refactorings are impossible in general under this proposal, or at least require transforming the relevant code in potentially non-trivial ways.
Structs with functions isn't the biggest deal, and namespaces can be simulated with a couple underscores. But I have a hard time with error handling if you don't have exceptions, any time I have a call stack more than 3-4 deep I find myself confused about how to treat certain errors. Then there's concurrency.
I do think that all semicolons really shouldn't be used. The only time I ever use semicolons is for error checking in Go.
Also, who cares what his style is?
If _you_ ever have to work on the code, run gofmt on it; if that's how he likes his go, good for him.
Me, because I found it unpleasant to read. Working on such code is beside the point.