3 ms·
I don't think that the with statement is evil. I find myself wanting to use it in lots of code. But, I would change it a little bit: instead of with ({foo
by aurelianito 15y ago
I don't think that the with statement is evil. I find myself wanting to use it in lots of code. But, I would change it a little bit:
instead of
with ({foo:42}) {
alert(foo)
}
I would like to be able to write:
with ({foo:42}) {
alert(.foo)
}
Note the dot before foo.
This would make an object the implicit receiver of methods and slots, allowing interesting idioms.