Rasmus Lerdorf skrev:
I think that is one of the strongest reasons not to implement something
actually.  If there is a way to do something in a clear and concise
syntax, adding an alternate less clear syntax that isn't immediately
obvious to everyone simply obfuscates the language.

The other fatal blow to a feature like this is that it would be quite a
bit slower to compile and execute than the longer form because we now
can't simply do a single hash lookup in the function table when we see a
function.  We first have to walk up the tree of objects to see if there
is a method with this name, and if there is no method, then we assume it
is a straight function call, unless of course there is a __call()
method, then what?  Way too many gotchas here.


May I also add that the use of "with" is generally considered bad practice by leading JavaScript gurus like Douglas Crockford, David Flanagan, John Resig and PPK. I even have a vague memory of Brendan Eich commenting upon the feature negatively as well.

Crockford speaks at: http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/

Pro s& Cons are listed at:
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Statements:with

Erik Arvidsson warns against the use in JS at: http://erik.eae.net/archives/2005/04/11/18.39.51/

Lars Gunther

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to