Re: Execution order of PHP
| From: | Daniel Egeberg | Date: | Wed, 10 Mar 2010 20:51:47 +0000 |
| Subject: | Re: Execution order of PHP | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-302677@lists.php.net to get a copy of this message | ||
On Wed, Mar 10, 2010 at 14:41, Bob McConnell <rvm@cbord.com> wrote:
> From: Auke van Slooten
>
>> In a hobby project I'm relying on the order in which the following
> piece
>> of PHP code is executed:
>>
>> $client->system->multiCall(
>> $client->methodOne(),
>> $client->methodTwo()
>> );
>>
>> Currently PHP always resolves $client->system (and executes the __get
> on
>> $client) before resolving the arguments to the multiCall() method
> call.
>>
>> Is this order something that is specified by PHP and so can be relied
>> upon to stay the same in the future or is it just how it currently
> works.
>>
>> If it cannot be relied upon to stay this way, I will have to rewrite
> the
>> multiCall method and API...
>
> Think about it from the parser's point of view. It has to evaluate
> $client->system to determine the parameter list for multiCall(). Then it
> has to evaluate those parameters before it can stuff their values into
> the stack so it can call the function.
That's not true. It's entirely possible making languages that are lazy
evaluated. Haskell is an example of that.
--
Daniel Egeberg