Re: [PHP-DEV] [VOTE] Generators

2012-08-26 Thread Stas Malyshev
Hi! > I think the generators RFC has been discussed thoroughly enough by > now, so I opened the vote: > > https://wiki.php.net/rfc/generators#vote I think it's fine but I'd still like to put forward a proposal to reconsider the requirement for parentheses in syntax like this: $data = (yield

Re: [PHP-DEV] [VOTE] Generators

2012-08-27 Thread Nikita Popov
On Sun, Aug 26, 2012 at 10:25 PM, Stas Malyshev wrote: > Hi! > >> I think the generators RFC has been discussed thoroughly enough by >> now, so I opened the vote: >> >> https://wiki.php.net/rfc/generators#vote > > I think it's fine but I'd still like to put forward a proposal to > reconsider t

RE: [PHP-DEV] [VOTE] Generators

2012-08-29 Thread Jared Williams
> -Original Message- > From: Nikita Popov [mailto:nikita@gmail.com] > Sent: 25 August 2012 17:11 > To: PHP internals > Subject: [PHP-DEV] [VOTE] Generators > > Hi internals! > > I think the generators RFC has been discussed thoroughly > enough by now, so I opened the vote: > >

Re: [PHP-DEV] [VOTE] Generators

2012-08-29 Thread Nikita Popov
On Wed, Aug 29, 2012 at 6:21 PM, Jared Williams wrote: > > >> -Original Message- >> From: Nikita Popov [mailto:nikita@gmail.com] >> Sent: 25 August 2012 17:11 >> To: PHP internals >> Subject: [PHP-DEV] [VOTE] Generators >> >> Hi internals! >> >> I think the generators RFC has been disc

Re: [PHP-DEV] [VOTE] Generators

2012-08-29 Thread Derick Rethans
On Wed, 29 Aug 2012, Nikita Popov wrote: > > function &bind(array $keys, array &$row) > > { > > foreach($keys as $key) > > yield $key => $row[$key]; > > } > > > > $row = []; > > $it = bind(['a', 'b'], $row); > > > > foreach($it as $key => &$ref) > > echo $key; > > e

Re: [PHP-DEV] [VOTE] Generators

2012-08-29 Thread Stas Malyshev
Hi! >> Thanks, this is now fixed. It'll throw an exception now, saying that >> you can't traverse an already closed generator. > > Nothing in the core throws an exception, why would this?! I'd rather have it skip foreach, maybe producing a warning/notice. It'd otherwise also be only place genera

Re: [PHP-DEV] [VOTE] Generators

2012-08-29 Thread Nikita Popov
On Wed, Aug 29, 2012 at 10:10 PM, Derick Rethans wrote: > On Wed, 29 Aug 2012, Nikita Popov wrote: > >> > function &bind(array $keys, array &$row) >> > { >> > foreach($keys as $key) >> > yield $key => $row[$key]; >> > } >> > >> > $row = []; >> > $it = bind(['a', 'b'], $row)

Re: [PHP-DEV] [VOTE] Generators

2012-08-29 Thread Gustavo Lopes
On Wed, 29 Aug 2012 22:10:52 +0200, Derick Rethans wrote: On Wed, 29 Aug 2012, Nikita Popov wrote: > function &bind(array $keys, array &$row) > { > foreach($keys as $key) > yield $key => $row[$key]; > } > > $row = []; > $it = bind(['a', 'b'], $row); > > foreach($it as

Re: [PHP-DEV] [VOTE] Generators

2012-08-29 Thread Derick Rethans
On Wed, 29 Aug 2012, Nikita Popov wrote: > On Wed, Aug 29, 2012 at 10:10 PM, Derick Rethans wrote: > > On Wed, 29 Aug 2012, Nikita Popov wrote: > > > >> > function &bind(array $keys, array &$row) > >> > { > >> > foreach($keys as $key) > >> > yield $key => $row[$key]; > >>

Re: [PHP-DEV] [VOTE] Generators

2012-08-29 Thread Hannes Magnusson
On Wed, Aug 29, 2012 at 10:19 PM, Derick Rethans wrote: > On Wed, 29 Aug 2012, Nikita Popov wrote: > >> On Wed, Aug 29, 2012 at 10:10 PM, Derick Rethans wrote: >> > On Wed, 29 Aug 2012, Nikita Popov wrote: >> > >> >> > function &bind(array $keys, array &$row) >> >> > { >> >> > foreach($ke

Re: [PHP-DEV] [VOTE] Generators

2012-08-29 Thread Pierre Joye
hi! On Wed, Aug 29, 2012 at 11:19 PM, Derick Rethans wrote: > "ext/spl" - SPL is not *core* language. The generators are. Don't throw > exceptions from core features! I would not have a problem with exceptions here. It is much cleaner than yet another warning. Cheers, -- Pierre @pierrejoye |

RE: [PHP-DEV] [VOTE] Generators

2012-08-29 Thread Jared Williams
> -Original Message- > From: Hannes Magnusson [mailto:hannes.magnus...@gmail.com] > Sent: 29 August 2012 22:50 > To: Derick Rethans > Cc: Nikita Popov; Jared Williams; PHP internals > Subject: Re: [PHP-DEV] [VOTE] Generators > > On Wed, Aug 29, 2012 at

Re: [PHP-DEV] [VOTE] Generators

2012-08-29 Thread Yasuo Ohgaki
Hi, 2012/8/30 Pierre Joye : > hi! > > On Wed, Aug 29, 2012 at 11:19 PM, Derick Rethans wrote: > >> "ext/spl" - SPL is not *core* language. The generators are. Don't throw >> exceptions from core features! > > I would not have a problem with exceptions here. It is much cleaner > than yet another w

Re: [PHP-DEV] [VOTE] Generators

2012-08-30 Thread Derick Rethans
On Wed, 29 Aug 2012, Stas Malyshev wrote: > >> Thanks, this is now fixed. It'll throw an exception now, saying > >> that you can't traverse an already closed generator. > > > > Nothing in the core throws an exception, why would this?! > > I'd rather have it skip foreach, maybe producing a warni

Re: [PHP-DEV] [VOTE] Generators

2012-08-30 Thread Derick Rethans
On Thu, 30 Aug 2012, Yasuo Ohgaki wrote: > 2012/8/30 Pierre Joye : > > > > On Wed, Aug 29, 2012 at 11:19 PM, Derick Rethans wrote: > > > >> "ext/spl" - SPL is not *core* language. The generators are. Don't > >> throw exceptions from core features! > > > > I would not have a problem with exceptio

Re: [PHP-DEV] [VOTE] Generators

2012-08-30 Thread Derick Rethans
On Wed, 29 Aug 2012, Gustavo Lopes wrote: > On Wed, 29 Aug 2012 22:10:52 +0200, Derick Rethans wrote: > > > On Wed, 29 Aug 2012, Nikita Popov wrote: > > > > > > function &bind(array $keys, array &$row) > > > > { > > > > foreach($keys as $key) > > > > yield $key => $row[$

Re: [PHP-DEV] [VOTE] Generators

2012-08-30 Thread Andrew Faulds
Derick Rethans wrote: >Nothing shows that they are. In any example I saw, I don't even see any > >OO syntax/functionality. For me, "yield" is a core syntax *keyword*, >and >hence: no exceptions. > I was unware PHP was a purist, non-OOP language. What is "OO syntax" anyway? Why can the core no

Re: [PHP-DEV] [VOTE] Generators

2012-08-30 Thread Lester Caine
Andrew Faulds wrote: Derick Rethans wrote: >Nothing shows that they are. In any example I saw, I don't even see any > >OO syntax/functionality. For me, "yield" is a core syntax*keyword*, >and >hence: no exceptions. > I was unware PHP was a purist, non-OOP language. What is "OO syntax" anyway?

Re: [PHP-DEV] [VOTE] Generators

2012-08-30 Thread Nikita Popov
On Thu, Aug 30, 2012 at 10:27 AM, Derick Rethans wrote: > On Wed, 29 Aug 2012, Stas Malyshev wrote: > >> >> Thanks, this is now fixed. It'll throw an exception now, saying >> >> that you can't traverse an already closed generator. >> > >> > Nothing in the core throws an exception, why would this?!

Re: Re: [PHP-DEV] [VOTE] Generators

2012-08-30 Thread Morgan L. Owens
On 2012-08-30 20:39, Derick Rethans wrote: On Wed, 29 Aug 2012, Gustavo Lopes wrote: On Wed, 29 Aug 2012 22:10:52 +0200, Derick Rethans wrote: Nothing in the core throws an exception, why would this?! This is not accurate. All the iterators throw exceptions on similar situations. Generato

Re: Re: [PHP-DEV] [VOTE] Generators

2012-08-31 Thread jpauli
Heh, we face a true problem here, and it's deeper than just "should generators throw exception or not". Adding Derick's notice, -which is true- it becomes "should Core features start throwing Exception knowing we've been fighting to prevent that for years ?". Generator use objects, right ; but as

[PHP-DEV] No thread hijacking! (Was: RE: [PHP-DEV] [VOTE] Generators)

2012-08-30 Thread Derick Rethans
On Wed, 29 Aug 2012, Jared Williams wrote: > Speaking of IteratorAggregates and spl. > I think there should be some discussion about what can be done to get > the spl iterators to handle references. Please do not hijack threads. Start a new one with a new subject. And do *not* reply to an old