> On Sep 2, 2020, at 5:54 PM, Stanislav Malyshev wrote:
>
> Hi!
>
>>> In theory, this should be a general performance win any time one
>>> needs to iterate over only the keys of an iterable, because it does
>>> not require the use of an O(n) iteration and building of the array
>>> that array_key
Hi Benas IML,
> I'd also like to mention that other languages don't have any kind of
> syntactic sugar/special syntax for iterating over keys. That is achieved
> using a function though.
That's not true, Golang has iterating over keys by default and a more verbose
syntax to iterate over values.
Hi!
>> In theory, this should be a general performance win any time one
>> needs to iterate over only the keys of an iterable, because it does
>> not require the use of an O(n) iteration and building of the array
>> that array_keys() would, plus it works on non-array types (such as
>> generators o
On Wed, 2 Sep 2020, 21:54 Dik Takken, wrote:
> On 02-09-2020 21:31, Dik Takken wrote:
> > Even if we decide that it is not worth the trouble for foreach loops,
> > there are other cases where this new syntax can work well. Array
> > destructuring has already been mentioned.
>
> Replying to myself
> On Sep 2, 2020, at 12:05 PM, Michael Voříšek - ČVUT FEL
> wrote:
>
> I like "void", as "null" can be ambiguous.
>
> Imagine function example($a = 'default value 1', $b = 'default value 2') {}
>
> With "void", we can allow skipping arguments in advance to the default
> pamameter value like
On 02-09-2020 21:31, Dik Takken wrote:
> Even if we decide that it is not worth the trouble for foreach loops,
> there are other cases where this new syntax can work well. Array
> destructuring has already been mentioned.
Replying to myself: It just occurred to me that array destructuring
already
On 02-09-2020 19:13, Nikita Popov wrote:
> Just like the first time this was discussed, I don't think this RFC makes a
> sufficient case on why we need explicit syntax for this. Just ignoring the
> value is an existing pattern that works across all PHP versions:
>
> foreach ($iterable as $key
I understand... seems that `$this` is very confusing inside `__clone()`:
when writing, it writes to the clone, when reading it reads from original.
Seems valid a new optional parameter definition with the original source.
Atenciosamente,
David Rodrigues
Em qua., 2 de set. de 2020 às 15:41, Mi
On Wed, Sep 2, 2020 at 1:13 PM Nikita Popov wrote:
> On Wed, Sep 2, 2020 at 5:16 AM Mike Schinkel wrote:
>
> > This is a new thread for John Bafford's RFC which he mentioned on another
> > thread, see below:
> >
> > https://wiki.php.net/rfc/foreach_void <
> > https://wiki.php.net/rfc/foreach_voi
Hi, please look at
https://stackoverflow.com/questions/63675888/get-original-source-instance-in-clone
do you have anything against updating PHP to pass "instance before
cloned" to any __clone call from php?
no BC - user may accept this extra argument or declare function
__clone() without any
+1.
I'd also like to mention that other languages don't have any kind of
syntactic sugar/special syntax for iterating over keys. That is achieved
using a function though.
This proposal to me seems a bit like the "return if/guard" RFC i. e. I see
no value in it.
On Wed, Sep 2, 2020, 8:13 PM Nikit
On Wed, Sep 2, 2020 at 5:16 AM Mike Schinkel wrote:
> This is a new thread for John Bafford's RFC which he mentioned on another
> thread, see below:
>
> https://wiki.php.net/rfc/foreach_void <
> https://wiki.php.net/rfc/foreach_void>
>
Just like the first time this was discussed, I don't think t
I like "void", as "null" can be ambiguous.
Imagine function example($a = 'default value 1', $b = 'default value 2')
{}
With "void", we can allow skipping arguments in advance to the default
pamameter value like example(void, 'test');.
With kind regards / Mit freundlichen Grüßen / S přátels
On Wed, 2 Sep 2020 at 18:58, Ben Ramsey wrote:
>
> > On Sep 2, 2020, at 11:14, Lester Caine wrote:
> >
> > On 02/09/2020 15:31, Thomas Bley wrote:
> >> I'd also like to propose to use null:
> >> [null, null, $username] = getUserData();
> >> foreach ($source as $key => null) {}
> >
> > Exactly w
> On Sep 2, 2020, at 11:14, Lester Caine wrote:
>
> On 02/09/2020 15:31, Thomas Bley wrote:
>> I'd also like to propose to use null:
>> [null, null, $username] = getUserData();
>> foreach ($source as $key => null) {}
>
> Exactly what null is designed for ...
I second (or third) `null`.
Over
On Wed, Sep 2, 2020 at 9:31 AM Thomas Bley wrote:
> Hello,
>
> I'd also like to propose to use null:
>
> [null, null, $username] = getUserData();
>
> foreach ($source as $key => null) {}
>
>
These both look like great, expressive syntaxes. No new keywords, no major
change to existing idioms, jus
On 02/09/2020 15:31, Thomas Bley wrote:
I'd also like to propose to use null:
[null, null, $username] = getUserData();
foreach ($source as $key => null) {}
Exactly what null is designed for ...
--
Lester Caine - G8HFL
-
Contact - https://lsces.uk/wiki/Contact
L.S.
Hello,
I'd also like to propose to use null:
[null, null, $username] = getUserData();
foreach ($source as $key => null) {}
Regards
Thomas
> David Rodrigues hat am 02.09.2020 16:24 geschrieben:
>
>
> I think "void" is a good solution and is very clear, compared to "_".
>
> [void, void, $us
I think "void" is a good solution and is very clear, compared to "_".
[void, void, $username] = getUserData();
Atenciosamente,
David Rodrigues
Em qua., 2 de set. de 2020 às 10:57, Dik Takken
escreveu:
> On 02-09-2020 15:35, Chase Peeler wrote:
> > Isn't the underscore an alias for gettext()?
On 02-09-2020 15:35, Chase Peeler wrote:
> Isn't the underscore an alias for gettext()?
You are right, it is. Now this does not necessarily mean that underscore
cannot be used for ignored variables. Depending on the context in which
it is used an underscore may or may not be ambiguous.
Since we a
On Wed, Sep 2, 2020 at 9:16 AM Josh Bruce wrote:
>
> > On Sep 2, 2020, at 6:27 AM, Dik Takken wrote:
> >
> > On 02-09-2020 12:48, Olle Härstedt wrote:
> >> An alternative syntax would be
> >>
> >>foreach($iterable as $key => _) { ... }
> >>
> >> Using underscore as a way to signal "I don't
> On Sep 2, 2020, at 6:27 AM, Dik Takken wrote:
>
> On 02-09-2020 12:48, Olle Härstedt wrote:
>> An alternative syntax would be
>>
>>foreach($iterable as $key => _) { ... }
>>
>> Using underscore as a way to signal "I don't care about this value".
>> Same could be possible with list dest
Hi,
This vote has now been concluded. The primary vote to re-choose with STV
was accepted, with 50 for and 11 against.
The STV selection selected the syntax:
#[Attr]
The full STV run is at
https://gist.github.com/3c1f41afbabdeaa0c12753397833db8c
Thanks all for participating and votin
On 02-09-2020 12:48, Olle Härstedt wrote:
> An alternative syntax would be
>
> foreach($iterable as $key => _) { ... }
>
> Using underscore as a way to signal "I don't care about this value".
> Same could be possible with list destructoring, like
>
> [_, _, $something] = foo();
>
> This
An alternative syntax would be
foreach($iterable as $key => _) { ... }
Using underscore as a way to signal "I don't care about this value".
Same could be possible with list destructoring, like
[_, _, $something] = foo();
This syntax comes from OCaml. Possibly other languages, too? Not s
25 matches
Mail list logo