melfar a écrit :
Hey,

Yep, I think there might be some caveats to that change.
The original patch did not work on methods, so I've fixed that and also
made the return value an rvalue, so that you can't attempt to modify the
temporary value, the zend_check_writable_variable guard will yield an error.

The updated patch can be found at http://bugs.php.net/bug.php?id=50003

I've also heard an opinion that adding this construction is just going to make things more
complicated, but take this: chained -> operators are supported for return
values and I'm only seeing code getting simpler because of that.


Why isn't a mater of pushing the function call statement into a valuable
statement?

I guess something like this:

statement :
        | value
        | function_call;


value :
        | valriable
        | array_access
        | method_send
        | ...;

array_access :
        | value '[' value ']';
Into:


statement :
        | value;


value :
        | valriable
        | array_access
        | function_call
        | method_send
        | ...;

array_access :
        | value '[' value ']';


You also could push the new statement into the value so you can do:

(new A())->foo();

or

foo(new A());

-mthk


Br,
-melfar

"mm w" <0xcafef...@gmail.com> wrote:

Hi Melfar, from my point of view I am totally to make this a legal
call like in python or ruby java,
as I liked compact code I liked to avoid temp vars especially on a
read-only call, but it might require some effort there and the final
patch might be not so simple, anyway this is a community call, what I
can say about this kind of missing feature "sometimes, I can hear in
my office" : "PHP is a retarded language, PHP sucks or worst", my
point there, that is sometimes good to listen to people who are not
"passionate" by the language but just using it to do their job and be
paid.

Cheers!

On Sat, Nov 7, 2009 at 3:42 AM, melfar <mel...@gmail.com> wrote:
Hello!

I have filed a bug (suggestion) at http://bugs.php.net/bug.php?id=50003
What do you think about enabling such a constructions in future versions of
php?

Br,
-melfar



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to