3 ms·
This is certainly elegant but I'm not sure I'd want to work in a large codebase full of this kind of code. Sometimes it's easier to just see a loop spelled out
by cageface 12y ago
This is certainly elegant but I'm not sure I'd want to work in a large codebase full of this kind of code. Sometimes it's easier to just see a loop spelled out in front of you. I'm a critic of Go in many ways but I do think there is something to their principle of keeping code very simple and readable and localized.
- augustl 12y agoI'm sure something said that about for loops vs goto some time ago :) Personally (which is important, readability is relative) I find for loops less readable than traditional FP functions like filter, any?, map, etc - I don't have to carefully read the entire for loop to know what's going on. I prefer composability of known pieces, over constructs that can do anything.
- nickik 12y agoI think this is ok if you only use once, but as soon as you begin to use the same alorithm in multible places and contects you be happy with having it stored in one place. In go you will have to replicate to logic every single time. I have not used much, but the fact that I cant even use generic map/filter things make me not want to try it. Even when I first learned programming (in C) I was trying to figure out how not to write for (int x=0;x==5;x++) again and again. I dont really want to go back to that.