Re: PHP 5.1
| From: | Zeev Suraski | Date: | Thu, 16 Jun 2005 17:24:13 +0000 |
| Subject: | Re: PHP 5.1 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-16755@lists.php.net to get a copy of this message | ||
At 20:16 16/06/2005, Marcus Boerger wrote:
Hello Zeev, Thursday, June 16, 2005, 7:12:49 PM, you wrote: Marcus, If you read what I said in my emails on this topic, it's clear that I know that this is the case. As I said, this approach has the side effect of creating an empty placeholder if the variable to be checked doesn't exist. I also said that I think it would usually make more sense to simply assign the variable with the wanted value, instead of just returning that value, so that you don't have to clutter your code with ifsetor()'s or whatever each coder ends up calling this (sometimes it may not be desirable, obviously, but I assume it would be more often than not). At the end of the day, this is really a nuance. Fact is that it's possible to implement ifsetor() functionality today in userland. We cannot go around implementing a new construct for every possible thing that someone might need. This should be implemented in userland, even if it has a small side effect. It gives you the full power of doing whatever you want, instead of being limited to what a low level construct does. Fact is it's not. Try it and show it here.Someone else already did.
We wouldn't discuss it if it was possible.Sure we would. I know a great part of the reason you wanted ifsetor() is performance. With the proposed userland approach, performance would obviously be worse than the ? : approach since it uses a more expensive function call. As I said in the past, that too isn't good enough a reason to introduce a new construct - since we'd find ourselves cluttered with constructs for everything. It's no scoop that C is faster than PHP. Zeev