艾伦风暴回应我关于with声明的回答的评论让我思考.我很少找到使用这种特定语言功能的理由,并且从未考虑过如何引起麻烦.现在,我很好奇如何有效地利用with它,同时避免陷阱.
with
你在哪里发现该with声明有用?
javascript language-features with-statement
我知道在Javascript中不推荐使用with -statement ,在ECMAScript 5中禁止使用with -statement ,但是它允许用Javascript创建一些不错的DSL.
例如CoffeeKup -templating引擎和Zappa web DSL.那些使用一些非常 奇怪的范围方法和with -statement来实现DSLish的感觉.
with -statement和这些类型的DSL 有未来吗?
没有with -statement 可以实现这种DSL效果吗?
javascript dsl coffeescript ecmascript-5
javascript ×2
coffeescript ×1
dsl ×1
ecmascript-5 ×1
language-features ×1
with-statement ×1