Re: new feature -> with()
| From: | Rasmus Lerdorf | Date: | Wed, 10 Oct 2007 16:37:14 +0000 |
| Subject: | Re: new feature -> with() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32727@lists.php.net to get a copy of this message | ||
Stut wrote:
> It may not be clear to some people, but there are many things in the
> every language that aren't necessarily obvious and I don't think that's
> a reason not to implement something.
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.
-Rasmus