Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I _think_ what they're saying is a specialized/curried function that takes a single argument is better than the method it's replacing that takes three strings or whatever. That is, `foo.a("a").b("b").c("c")` is better than `foo.a("a", "b", "c")`. Which...sure, but 1. if you're really passing 2-3 parameters in with identical types, maybe use inline value classes instead? Or at least type aliases?, and 2. if you can't or don't want to do that, named arguments help.


Type safe builders/factories work and should be used where appropriate (e.g. to catch invalid state at compile time) but I don't see how this has anything to do with the currying shown in the post. The compiler checks the param types whether the function has a single param or not.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: