Bob McConnell 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()
);
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. But, whether it evaluates the
parameter list left-to-right or vice versa is implementation dependent.
I don't believe you can rely on it always being the same unless you
always use the same interpreter.
I don't mind about the order in which the parameters are evaluated. The
only thing that must stay the same for my code to work as designed is
that $client->system is evaluated before any of the arguments to the
multiCall method. Your explanation seems reasonable to me, but I've been
informed by people that know more about parsers and compilers than me,
that theoretically there is no requirement for this to be true...
After a further education just now, it is possible for a compiler to
parse the entire multiCall right to left, so it will first evaluate
$client->methodTwo(), then $client->methodOne() and only then resolves
$client->system->multiCall. Before evaluating this call, the compiler
can still check whether the number of arguments matches the parameter
list of the function definition.
Anyway, the point is that I'd like to be able to write multiCall
statements like written above instead of doing something like this:
$client->system->multiCall(
array( 'method' => 'methodOne',
'params' => array() ),
array( 'method' => 'methodTwo',
'params' => array() )
);
regards,
Auke van Slooten
Muze
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php