Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-07 Thread Harrison Yuan
Sorry for the ambiguity in my original message, and thanks to Tig for PM-ing me about that. To clarify, I support the syntax for: echo function(var)[0]; and I believe this syntax: $tmp = getimagesize('./path/to/image'); echo $tmp[1]; to be awkward and inconvenient. Furthermore, it feels

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-07 Thread Felipe Pena
Hi all, 2010/6/5 Felipe Pena felipe...@gmail.com Hi! 2010/6/4 Stas Malyshev smalys...@sugarcrm.com Hi! function call chaining (f()() if f() returns function), and array dereferencing (f()[0]) - (Stas) I did patch for f()() - it's referenced at http://wiki.php.net/rfc/fcallfcall -

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-05 Thread Harrison Yuan
I don't understand what is holding PHP back from having this syntax. Tig said: ? $tmp = getimagesize('./path/to/image'); echo $tmp[1]; ? The need to assign the trivial variable $tmp first is completely arbitrary. Is it not a design goal somewhere that languages should allow the greatest degree

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-05 Thread Felipe Pena
Hi! 2010/6/4 Stas Malyshev smalys...@sugarcrm.com Hi! function call chaining (f()() if f() returns function), and array dereferencing (f()[0]) - (Stas) I did patch for f()() - it's referenced at http://wiki.php.net/rfc/fcallfcall - but not for f()[] - didn't have time for that yet.

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-04 Thread mathieu.suen
Hi Why not something more generic. Someone could think of a ValueNode. Then it could be use for object, array, any primitive type ... I will take the ValueNode as a non terminal grammar node. So first we could do that: ValueNode-method(); ValueNode::sMethod(); ValueNode[]; foo(ValueNode);

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-04 Thread Richard Quadling
On 4 June 2010 08:18, mathieu.suen mathieu.s...@easyflirt.com wrote: Hi Why not something more generic. Someone could think of a ValueNode. Then it could be use for object, array, any primitive type ... I will take the ValueNode as a non terminal grammar node. So first we could do that:

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-04 Thread mathieu.suen
On 06/04/2010 10:00 AM, Richard Quadling wrote: On 4 June 2010 08:18, mathieu.suenmathieu.s...@easyflirt.com wrote: Hi Why not something more generic. Someone could think of a ValueNode. Then it could be use for object, array, any primitive type ... I will take the ValueNode as a non

[PHP-DEV] Suggestion: echo function(var)[0];

2010-06-03 Thread Tig
Would be at all possible to implement this kind of shortcut? echo function(var)[0]; For example, to print the height of an image: ? echo getimagesize('./path/to/image')[1]; ? Sure, if you want more than one of the returned array points, this would not be very efficient, however when you do

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-03 Thread Kalle Sommer Nielsen
Hi Tig 2010/6/4 Tig tigger...@gmail.com: Would be at all possible to implement this kind of shortcut? Its called array-dereferencing and it was proposed countless times, including by myself. There is an RFC for this[1] and it was planned on the old PHP6 todo at the PDT[2]. [1]

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-03 Thread Tig
On Fri, Jun 4, 2010 at 11:19 AM, Kalle Sommer Nielsen ka...@php.net wrote: Hi Tig 2010/6/4 Tig tigger...@gmail.com: Would be at all possible to implement this kind of shortcut? Its called array-dereferencing and it was proposed countless times, including by myself. There is an RFC for

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-03 Thread Jonathan Wage
Hi, Has anyone attempted a patch for this? Or does anyone have an idea of the feasibility? Is it technically possible in a good/clean way? - Jon On Thu, Jun 3, 2010 at 9:29 PM, Tig tigger...@gmail.com wrote: On Fri, Jun 4, 2010 at 11:19 AM, Kalle Sommer Nielsen ka...@php.net wrote: Hi Tig

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-03 Thread Jonathan Wage
Hi, I've always wondered the same thing too. Would be a nice improvement. - Jon On Thu, Jun 3, 2010 at 9:12 PM, Tig tigger...@gmail.com wrote: Would be at all possible to implement this kind of shortcut? echo function(var)[0]; For example, to print the height of an image: ? echo

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-03 Thread Kalle Sommer Nielsen
2010/6/4 Tig tigger...@gmail.com: On Fri, Jun 4, 2010 at 11:19 AM, Kalle Sommer Nielsen ka...@php.net wrote: So does this mean array-dereferencing was original declined but still a possible for PHP 6? That is how I'm reading it, but just want to make sure. I belive its because when its been

Re: [PHP-DEV] Suggestion: echo function(var)[0];

2010-06-03 Thread Stas Malyshev
Hi! function call chaining (f()() if f() returns function), and array dereferencing (f()[0]) - (Stas) I did patch for f()() - it's referenced at http://wiki.php.net/rfc/fcallfcall - but not for f()[] - didn't have time for that yet. It should not be too hard to do, one just has to be