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

2010-06-07 Thread Felipe Pena
Hi all, 2010/6/5 Felipe Pena > Hi! > > 2010/6/4 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()[] -

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-06 Thread Jille Timmermans
Felipe Pena schreef: > Hi! > > 2010/6/4 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

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

2010-06-05 Thread Felipe Pena
Hi! 2010/6/4 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

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: 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 of literal expression possible, consistent with existing sy

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.suen 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 fir

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

2010-06-04 Thread Richard Quadling
On 4 June 2010 08:18, mathieu.suen 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: > > ValueNode->meth

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); ech

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 caref

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

2010-06-03 Thread Kalle Sommer Nielsen
2010/6/4 Tig : > On Fri, Jun 4, 2010 at 11:19 AM, Kalle Sommer Nielsen 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 proposed countless times on th

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 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 getimagesize('./path/t

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 wrote: > On Fri, Jun 4, 2010 at 11:19 AM, Kalle Sommer Nielsen > wrote: > > Hi Tig > > > > 2010/6/4 Tig : > >> W

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 wrote: > Hi Tig > > 2010/6/4 Tig : >> 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

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

2010-06-03 Thread Kalle Sommer Nielsen
Hi Tig 2010/6/4 Tig : > 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] http://wiki.php.net/rfc/functionarr

[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: Sure, if you want more than one of the returned array points, this would not be very efficient, however when you do only need one, it would be a lot nicer than: A