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

Sure there are - why are so many Crockford pronouncements taken as a signal to stop thinking?

Notice that his "with is bad" examples (which are usually bad examples and bad usages [1]) always involve contrived examples of potentially ambiguous assignment - one of the more useful ways to use `with` is with objects whose properties are DSL-like functions, named in such a way that there's no mistaking their origin and with no ambiguous assignment involved.

Simple example with includes: https://github.com/insin/DOMBuilder/blob/master/examples/red...

More extensive example of inheritable templates for a CRUD admin app: https://github.com/insin/sacrum/blob/master/lib/sacrum/admin...

[1] http://webreflection.blogspot.com/2009/12/with-worlds-most-m...



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

Search: