News for hackers. Stuff that matters.
Re:Currying in Kotlin by pixel_tracing on Saturday September 02, 2023 @08:36PM (#37366708)
It _is_ literally increasing complexity. Because now the call stack has added layers of indirection:

[0] abort() [1] curry call site [2] partial closure 1 [3] partial closure 2 [4] partial closure 3 [5] partial closure 4 [6] <actual place of issue> [7] partial closure 5 [8] partial closure 6

Compare this to something isn’t using currying:

[0] abort() [1] call-site 1 [2] call-site 2 <actual place of issue> [3] call-site 3

Dealt with this enough at a previous company I’m glad on my team at FAANG people are reasonable and don’t just shoehorn functional paradigms unnecessarily

Re:Currying in Kotlin by Clamchop on Saturday September 02, 2023 @09:16PM (#37366879)
The curried example actually could only ever add one to the call stack, no matter how many times you do it.

And another thing, currying is one way of decomposing functions. Either your first example is decomposed too much or your second too little.

But I also am less comfortable working in a functional style.

Re:Currying in Kotlin by noelwelsh on Sunday September 03, 2023 @04:09AM (#37368637)
You're only looking at one dimension of complexity. There are tradeoffs.