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

An old grad school connection of mine wrote a formal semantics for ES5 and couldn't explain what "with" did in words.



This is JavaScript, so there are probably tons of weird edge cases, but basically, within a with (expr) { … } block, everything defined on expr is put in scope:

  with (Math) with (console) log(PI)
It reminds me a bit of Clojure's doto.


Or java’s static import




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

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

Search: