"BJörn Lindqvist" <[EMAIL PROTECTED]> wrote:

> ? Not having to bother with petty things like that is an advantage.
> Javascript has with-statements that are equivalent to your
> using-statements but from what I've seen most programmers avoid them.
> They don't increase readability one bit.

That is at least partly because Javascript with statements are badly 
broken. Consider the following code:

function setit(a) {
   with (a) { x = 1; };
   return a;
}
var x;
delete x;
alert(setit({'x':0}).x);
alert(setit({'y':0}).x);
alert(x);


If 'a' has a property 'x' setit updates the property, otherwise it searches 
out the scope chain until it finds an object with an 'x' property and 
finally creates one on the global object if there isn't one.

So the output in this case is the sequence '1', 'undefined', '1'.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to