Hacker News new | past | comments | ask | show | jobs | submit login

To be sure, the example they give is the worst they could possibly find. I man, to keep out the current date is a laudable goal for a useful log function. But to make the current date a constant is OMG. This could even be useful in a limited form when you want to issue a bunch of messages that should all point to the same moment, but even then, saying `now = Date.now(); log now, ...; log now, ...` is so much simpler and clearer.

Also you totally do not need to be able to call `f( a, b ,c )` as `f( a )( b )( c )`, rather, you should avoid the latter for reasons of clarity, simplicity, and performance. You'd be just producing anonymous single-use throwaway functions for no good reason at all. You do not want to curry when you can just `g = ( a, c ) => f( a, 'xy', c );`. This is simpler, clearer, more flexible, and more to the point. Where this is not enough, just use a class. Everyone talks about inheritance, but where classes shine is that you can bind a multitude of functionality (implemented in methods) to a single set of configuration data (`this`) (and mutable state where called for).




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: