4 ms·
> efficient development I think the rationale for that is twofold: that as a static typed language that prefers stack allocation, you can get some very good pe
by lllr_finger 7y ago
> efficient development
I think the rationale for that is twofold: that as a static typed language that prefers stack allocation, you can get some very good performance without putting much effort into it, and that it's usually clear what the idiomatic way to accomplish something is. On the latter point, I appreciate golang's simplicity when I need to review other people's code or dig into third party libraries.
For the record, I agree with most of what you're saying. I also don't find it elegant, and most developers I know are eager to work in a different language after spending any amount of time in golang. Its benefits come at the expense of expressiveness, and I never thought I'd be doing things like code gen to work around a lack of generics in 2019.
- atilaneves 7y ago> you can get some very good performance Compared to... ? > I appreciate golang's simplicity when I need to review other people's code or dig into third party libraries. See, I don't. Every for loop has to be inspected to see if it's one of the 99.9% cases where it's a map, reduce, or filter. For loops can't be chained. Error handling takes up over half of a function. An algorithm library can't be written because of the lack of generics. Switching to Python, I'd much rather read: [x for x in xs if x % 2 == 0] Than: res = [] for x in xs: if x %2 == 0: res.append(x) 3 lines of boilerplate to do 1 line of work. Pass. Then there's the fact that everything is mutable in Go, so I have to track every and all variables in case they change. All in all, for me, reviewing code written in it is harder, not easier.
- RodgerTheGreat 7y agoIn K, I'd much rather read (~2!)#x (Not (~) modulo 2 (2!) filter (#) of x.) Or perhaps more idiomatically, x@&~2!x (x indexed (@) where (&) not (~) modulo 2 (2!) of x.) Reading a python comprehension requires awkward skipping around, and composing them together is a mess. APL-style uniform precedence is something I wish more languages imitated. Still, anything's better than an endless sea of for loops.
- yellowapple 7y agoI'm disappointed that these are not valid Perl programs (the first is a syntax error, and the second complains about an array where an operator is expected).
- teyc 7y agoThe Python expression closely represents how it is done in maths. {x∣x∈N,x<10}