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

> That said, I'm not sure what the exact reason was for choosing the syntax, as that was before my time.

I think the reason is just that it's very concise, and lightweight closure syntax makes things like `Option::map` feel like first-class parts of the language. The closure you pass just sort of seamlessly "blends in".

Note that having especially sugary here is not so uncommon, for example Haskell has `\x -> blah` for Rust's `|x| blah`.

I'm personally very happy that the closure syntax is as concise as it is.



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

Search: