> that doesn't clutter the language.
It actually does: now we have an expression-alike node that is lazy and
only evaluated when there's no default value. That's a lot of added
semantics for such an edge case feature.
Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/
On Mo
Den 2017-08-12 kl. 02:37, skrev Andreas Hennings:
This is true, I remember having done it in the past.
I still think it would be nice and feel natural to have the default
values directly built into the list construct.
It would be a bit faster, because it does not have to allocate a new
tempora
This is true, I remember having done it in the past.
I still think it would be nice and feel natural to have the default
values directly built into the list construct.
It would be a bit faster, because it does not have to allocate a new
temporary array.
Whether this difference matters depends on
You can merge the result with default values like this:
[$foo, $bar, $foobar] = explode(':', 'foo:bar') + [23, 42, 1337];
var_dump($foo, $bar, $foobar);
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
When you understand something, it often can be hard to understand why
others wouldn't. I don't see why people struggle with it either, but I do
see it happen quite a lot.
I would still think that if you are going to deconstruct something in a
structured way, you should validate your data is correc
"Andreas Hennings" wrote in message
news:CAH0Uv3HQK5wjcd_-9GynMw34H78ZTv09q9bc=yZ10JBbeT=v...@mail.gmail.com...
On Fri, Aug 11, 2017 at 12:01 AM, Devnuhl Unnamed
wrote:
Would isset($suffix) not suffice here?
You mean like so?
list($prefix, $suffix) = explode(':', 'string_without_suffix');
On Fri, Aug 11, 2017 at 12:01 AM, Devnuhl Unnamed wrote:
> Would isset($suffix) not suffice here?
You mean like so?
list($prefix, $suffix) = explode(':', 'string_without_suffix');
if (!isset($suffix)) {
..
}
The isset() is too late here, because the list() will already cause an error.
> Oth
Would isset($suffix) not suffice here? There are several things I've
thought of that would be other alternatives to changing this language
construct, but as I don't have my laptop with me, some of the testing to
confirm behavior will have to wait.
Other concerns fall around list() already being a
On Thu, Aug 10, 2017 at 5:21 PM, Andreas Hennings wrote:
> I found this RFC, describing a feature I wanted for a long time:
> https://wiki.php.net/rfc/list_default_value
> https://marc.info/?l=php-internals&m=144707619509724
>
> I regularly want this kind of feature when unpacking a string with ex
I don't have a strong opinion about the nested list() construct which
is also part of the RFC.
I never had a situation where I wanted this.
On Thu, Aug 10, 2017 at 11:21 PM, Andreas Hennings wrote:
> Hello list,
>
> I found this RFC, describing a feature I wanted for a long time:
> https://wiki.p
Hello list,
I found this RFC, describing a feature I wanted for a long time:
https://wiki.php.net/rfc/list_default_value
https://marc.info/?l=php-internals&m=144707619509724
(I don't know how to correctly reply to old emails that are not in my
inbox, sorry for that. I don't like mailing lists.)
On 1/21/2016 8:49 AM, reeze wrote:
> Bump this to continue discussion of this RFC (
> https://wiki.php.net/rfc/list_default_value).
>
> In case some of you didn't follow it before. This RFC propose to allow set
> default value in list() assignment:
>
> list($a = 'default value') = $arr;
>
tl;dr -
Bump this to continue discussion of this RFC (
https://wiki.php.net/rfc/list_default_value).
In case some of you didn't follow it before. This RFC propose to allow set
default value in list() assignment:
list($a = 'default value') = $arr;
On 10 November 2015 at 11:14, reeze wrote:
> Hey Dan,
Hey Dan,
On 9 November 2015 at 23:24, Dan Ackroyd wrote:
> Hi Reeze,
>
> On 9 November 2015 at 13:35, reeze wrote:
> > Hi internals!
> >
> > I'd like to open a discussion on the RFC to allow set default values for
> > list() assignment: https://wiki.php.net/rfc/list_default_value.
> >
> > What
Hi Reeze,
On 9 November 2015 at 13:35, reeze wrote:
> Hi internals!
>
> I'd like to open a discussion on the RFC to allow set default values for
> list() assignment: https://wiki.php.net/rfc/list_default_value.
>
> What is your idea?
I find the list construct to be quite magic already. Isn't it
Hi internals!
I'd like to open a discussion on the RFC to allow set default values for
list() assignment: https://wiki.php.net/rfc/list_default_value.
What is your idea?
Thanks.
--
Reeze Xia
http://reeze.cn
16 matches
Mail list logo