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

People intuitively expect things to happen imperatively (and eagerly). Imperativeness is deeply ingrained in our daily experience, due to how we interact with the world. While gaining familiarity helps, I’m not convinced that having imperative code as the non-default case that needs to be marked specially in the code and necessitates higher-order types is good ergonomics for a general-purpose programming language.



> People intuitively expect things to happen imperatively (and eagerly).

Eagerly? Yes. Imperatively? Not as much as SW devs tend to think.

When the teacher tells you to sort the papers alphabetically, he's communicating functionally, not imperatively.

When the teacher tells you to separate the list of papers by section, he's communicating functionally, not imperatively.

When he tells you to sum up the scores on all the exams, and partition by thresholds (90% and above is an A, 80% above and above is a B, etc), he's communicating functionally, not imperatively.

No one expects to be told to do it in a "for loop" style:

"Take a paper, add up the scores, and if it is more than 90%, put it in this pile. If it is between 80-90%, put it in this pile, ... Then go and do the same to the next paper."

People usually don't talk that way.


Nope. The fact that he's telling you a high-level command is irrelevant. (If you didn't know what “sort the papers” means, he'd have to tell you in more detail; it's just the difference between calling your built-in sort routine or coding it.)

Anyway: He's telling you to do something, and you do it. It doesn't get more imperative than that.


You’re talking about what vs. how, but imperative vs. pure-functional is both about the how, not the what.

When you’re explaining someone how to sort physical objects, they will think in terms of “okay I’ll do x [a physical mutable state change] and then I’ll have achieved physical state y, and then I’ll do z (etc.)”.


Well, declaratively, not functionally. But point mostly stands




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: