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

> Learning to read code is just like learning to read English. You can guess most of the words meaning once you know some of them. Personally, I think being able to read code is the best skill you can have as a programmer. Just as a good musician is able to listen to music properly. (I mean 'listen' as in analyze, understand, notate and copy).

Yes, that's very true, but it's also a red herring. Not all code is worth to read, nor is it worth to write. Certainly not either the copy+pasted mess that would result of not using first-class functions, or all the _noise_ introduced by their half assed expression using classes.

> The other point IMHO is that scattering your code with anonymous functions points to bad design and is as bad as scattering "GOTO" everywhere in BASIC code. It leads to spaghetti code which is an unmaintainable mess.

Spaghetti? Really? As in flow of control? You _really_ don't know what you are talking about. Sure, it does enable some trickery, like Continuation Passing Style, but if you are arguing that such a technique is a 'con' for the existence of what amounts to just both functions and lexical scope, you are grasping straws.

On the other hand, you have simple abstractions that are enabled by first-class functions, like map or the folds, and you won't have to hear of silliness like the 'Command Pattern' or the 'Strategy Pattern' to work around the restrictions that make them necessary. And the subsequent explosion in code, to be found later shoved in other classes and packages. They make dispatch tables easy, they give you a simple way to make asynchronous code, they allow wrappers for guarded code, they...

Do yourself a favour and take a good look to the first two chapters of SICP (http://mitpress.mit.edu/sicp/), most of their charm is displayed there.




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

Search: