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

Javascript iteration primitive isn't block-based.



Ruby iteration primitive isn’t block based, either.


Of course it is. `for a in b` desugars to `b#each`, not the other way around.


How do “while” and “until” desugar? Kernel#loop?


Those are two rare exceptions and you're right they don't desugar.


Those are not “exceptions” to Ruby’s primitives, those are Ruby’s primitives. Things that desugar to methods aren’t primitives.

The thing is, they’re rare in practice for cultural reasons.




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

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

Search: