Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-09 Thread Alban LEROUX
On 2010-06-09 16:06:37 +0200, Ferenc Kovacs said: In fact the uniq problem i see, is could be a name conflict like : function Foo() { // ... } class Foo() { public __create() { // ... } } Foo(); // Instanciate the class or call the function ? And I think that this is a much higher cost

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-09 Thread Stas Malyshev
Hi! Let's me take the name __create() for this example : We already have __construct for creating objects of class Foo, and if those are objects of another class, you can always have a static factory. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-09 Thread Ferenc Kovacs
> > > In fact the uniq problem i see, is could be a name conflict like : > > function Foo() { > // ... > } > > class Foo() { > public __create() { > // ... > } > } > > Foo(); // Instanciate the class or call the function ? > > And I think that this is a much higher cost, that we gain. If we w

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-09 Thread Alban LEROUX
On 2010-06-08 12:41:21 +0200, Johannes Schlüter said: On Tue, 2010-06-08 at 12:23 +0200, Jacob Oettinger wrote: Would it be equally simple to allow the syntax below? $result = new ResultMaker()->getIt(); does this mean $result = new (ResultMaker()->getIt()); or $result = (new Resu

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-08 Thread Peter Lind
On 8 June 2010 17:28, Brian Moon wrote: >> The operator that really determines this is 'new' - which is already >> documented. So there isn't any ambiguity. Not to say that documenting >> the other operators would be bad, just saying there's no ambiguity >> here :) >>  Also, allowing "new (blah())

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-08 Thread Brian Moon
The operator that really determines this is 'new' - which is already documented. So there isn't any ambiguity. Not to say that documenting the other operators would be bad, just saying there's no ambiguity here :) Also, allowing "new (blah());" would be a fairly big BC break I'd say. How? Mayb

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-08 Thread Peter Lind
On 8 June 2010 16:57, Ford, Mike wrote: >> -Original Message- >> From: Jacob Oettinger [mailto:ja...@oettinger.dk] >> Sent: 08 June 2010 14:09 >> >> On 08/06/2010, at 12.41, Johannes Schlüter wrote: >> >> > On Tue, 2010-06-08 at 12:23 +0200, Jacob Oettinger wrote: >> >> Would it be equally

RE: [PHP-DEV] [RFC] Array Dereferencing

2010-06-08 Thread Ford, Mike
> -Original Message- > From: Jacob Oettinger [mailto:ja...@oettinger.dk] > Sent: 08 June 2010 14:09 > > On 08/06/2010, at 12.41, Johannes Schlüter wrote: > > > On Tue, 2010-06-08 at 12:23 +0200, Jacob Oettinger wrote: > >> Would it be equally simple to allow the syntax below? > >> > >> $r

RE: [PHP-DEV] [RFC] Array Dereferencing

2010-06-08 Thread Dennis Haarbrink
> -Oorspronkelijk bericht- > Van: Lars Schultz [mailto:lars.schu...@toolpark.com] > Verzonden: dinsdag 8 juni 2010 16:04 > Aan: internals@lists.php.net > Onderwerp: Re: [PHP-DEV] [RFC] Array Dereferencing > > >> $result = new ResultMaker()->getIt(); >

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-08 Thread troels knak-nielsen
> > > $result = new ResultMaker()->getIt(); Isn't this issue just a matter of defining one thing as being correct and then get on with it? There are lots of ambiguities in php's grammar already. -- troels -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://ww

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-08 Thread Lars Schultz
$result = new ResultMaker()->getIt(); I know that this is not much of an argument, but it works the same way in Javascript too, which is very convenient. The intended behaviour is obvious...even though it could be (mis-)interpreted by php. Lars -- PHP Internals - PHP Runtime Development Ma

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-08 Thread Jacob Oettinger
On 08/06/2010, at 12.41, Johannes Schlüter wrote: > On Tue, 2010-06-08 at 12:23 +0200, Jacob Oettinger wrote: >> Would it be equally simple to allow the syntax below? >> >> $result = new ResultMaker()->getIt(); > > does this mean > >$result = new (ResultMaker()->getIt()); > > or > >$

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-08 Thread Johannes Schlüter
On Tue, 2010-06-08 at 12:23 +0200, Jacob Oettinger wrote: > Would it be equally simple to allow the syntax below? > > $result = new ResultMaker()->getIt(); does this mean $result = new (ResultMaker()->getIt()); or $result = (new ResultMaker())->getIt(); I assume the later, but that i

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-08 Thread Jacob Oettinger
Hi This is great. Would it be equally simple to allow the syntax below? $result = new ResultMaker()->getIt(); and $resultOfFunc = returnsFunc()(); I think would add consistency because it would allow direct operations on any returned value. I agree that it is not the most reader friendly cod

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-08 Thread Mark Skilbeck
On 08/06/10 02:14, Tig wrote: Thanks! Very happy about this :] -Tig +1 :D -- Mark Skilbeck mahcuz.com | gtk.php.net | pecl.php.net/cairo | docs.php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-07 Thread Joel Perras
I'll second that. I'm quite surprised that it was such a clean addition to the parser. I owe you a few beers, Felipe. -Joël On Mon, Jun 7, 2010 at 9:16 PM, Jonathan Wage wrote: > Thanks a bunch. This is a very nice improvement to PHP! > > - Jon > > On Mon, Jun 7, 2010 at 12:58 PM, Felipe Pena w

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-07 Thread Jonathan Wage
Thanks a bunch. This is a very nice improvement to PHP! - Jon On Mon, Jun 7, 2010 at 12:58 PM, Felipe Pena wrote: > Hi all, > I just edited the RFC page [1] about array dereferencing as now we have a > patch for such. > > RFC page: http://wiki.php.net/rfc/functionarraydereferencing > > The patc

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-07 Thread Tig
Thanks! Very happy about this :] -Tig -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-07 Thread Felipe Pena
2010/6/7 Stas Malyshev > Hi! > > > This is great. Did you check it on debug version though? I thought for >> some reason you'd have to take care of freeing the value (which is >> returned by function) after the expression is done, but maybe I missed >> something. It's be also nice to see some mo

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-07 Thread Stas Malyshev
Hi! This is great. Did you check it on debug version though? I thought for some reason you'd have to take care of freeing the value (which is returned by function) after the expression is done, but maybe I missed something. It's be also nice to see some more assignment tests (also maybe return-a

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-07 Thread Ferenc Kovacs
On Mon, Jun 7, 2010 at 9:22 PM, Pierre Joye wrote: > hi Felipe, > > Great work! thanks :) > > Patches looks very good, builds on my tests system here. > > No objection for trunk :) > > Cheers, > > On Mon, Jun 7, 2010 at 6:58 PM, Felipe Pena wrote: > > Hi all, > > I just edited the RFC page [1] a

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-07 Thread Pierre Joye
hi Felipe, Great work! thanks :) Patches looks very good, builds on my tests system here. No objection for trunk :) Cheers, On Mon, Jun 7, 2010 at 6:58 PM, Felipe Pena wrote: > Hi all, > I just edited the RFC page [1] about array dereferencing as now we have a > patch for such. > > RFC page:

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-07 Thread Rasmus Lerdorf
On 6/7/10 9:58 AM, Felipe Pena wrote: > Hi all, > I just edited the RFC page [1] about array dereferencing as now we have a > patch for such. > > RFC page: http://wiki.php.net/rfc/functionarraydereferencing > > The patch is simple, it just required to change the grammar file. I also > added some

Re: [PHP-DEV] [RFC] Array Dereferencing

2010-06-07 Thread Stas Malyshev
Hi! RFC page: http://wiki.php.net/rfc/functionarraydereferencing The patch is simple, it just required to change the grammar file. I also added some tests in the patch. This is great. Did you check it on debug version though? I thought for some reason you'd have to take care of freeing the