Notes on the Go translation of Reposurgeon (2020)
&gt; What I really missed was generic map-function-over-slice<p>Me too, and mapping a map, a channel, etc. With generics, things will be easier, we can have iterators, even lazy iterators, but there will still be no type inference in lambdas for arguments and return values and no easy currying, so things will still be awkward, but better.<p>&gt; Keyword arguments<p>You can kind of do that by passing a struct as an argument, and represent the optionalness by having a pointer in the struct. That&#x27;s still awkward, you can&#x27;t easily make a pointer to an integer or string literal, you need a separate helper function for each primitive type. Overall it could be nicer.<p>&gt; Annoying limitations on const<p>I think the Go constants are good, the fact that you can perform calculations on them in compile time also. But I wish there was some way to express immutability (and non-nilability) in the language. Programs are simpler with less moving parts.<p>&gt; 14KLOC -&gt; 21KLOC<p>That&#x27;s to be expected, Go could be nicer if it was more concise, obviously that&#x27;s a hard thing to balance, because you can end up with too obscure code, I just wish that there were some small improvements from time to time.<p>&gt; Absence of sum&#x2F;discriminated-union types<p>Yeah, I refer to it as Algebraic Data Types, where you can for example have your tree type to be a Node with children or a Leaf with value. And a function can accept a Tree that can be one of these. IIRC, the Go people claim that you can do kind of something like this with interfaces, but it&#x27;s not very nice to use interfaces in this way and has some drawbacks.<p>&gt; Catchable exceptions require silly contortions<p>I don&#x27;t like exceptions, they disrupt the flow of the program - any function call could &quot;return early&quot;, so you need to be always careful and account for that possibility. In C++ this was solved with RAAI, and it was a source of so many bugs that some companies just disallow exceptions internally.<p>&gt; Aesthetic doubt<p>Yeah, it&#x27;s there, some things in Go just come out ugly.<p>&gt; Absence of iterators<p>Yes. Hopefully generics will enable implementing them.