|
|
|
|
|
by geocar
1494 days ago
|
|
> implied you're looping over all the elements of x, whereas if it was just function composition it would return a function taking an index. I think it's a mistake to make this assumption. In C, if you saw: f(g(x));
you wouldn't expect to be able to make any assumptions about how many loops are going on in there. Python programmers are often overloading their functions too, so you can't even say anything about x+y in Python. I actually think it's the norm that you have to dig all the way down to understand what's going on, and it's the same thing happening here: Yes either f or g might be a loop. Or both. That's just life.At the end of the day, the only thing I think that helps with that is having less code to read (in source-code bytes). |
|
I think you might have misunderstood me. However since I don't know k well enough, maybe my point was based on a misunderstanding as well.
What I was trying to get at was that, as you also note, overloading makes it harder to keep track of what the code does. Sometimes this terseness is worth it, and that might be the case for k and friends once you know it.
> the only thing I think that helps with that is having less code to read
I don't have experience with k, so things might be different there. But certainly for me, it is not true in say Python or C# etc where I find less code can be significantly more difficult to read and understand. Of course that doesn't mean writing highly verbose code is automatically better, the optimum is somewhere in between.
For example, often it's just as important to know why some code does what it does, so splitting up operations, using more verbose with variable names etc can make the code significantly more self-documenting.