Re: new feature -> with()
| From: | Stut | Date: | Wed, 10 Oct 2007 16:40:43 +0000 |
| Subject: | Re: new feature -> with() | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32728@lists.php.net to get a copy of this message | ||
Rasmus Lerdorf wrote:
Stut wrote:Fair point, although as I stated this one is obvious to me.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.Hadn't considered __call() possibilities, and I didn't think the performance hit would be too great but I'm the first to admin I don't know the innards of PHP particularly well yet. -Stut -- http://stut.net/