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 correct beforehand. And
that would be the more ideal solution here. But if replies to a genuine
concern over things I've witnessed is going to be met with a dismissive
attitude, I'm just going to bow out entirely.

Chris

On Aug 10, 2017 5:40 PM, "Andreas Hennings" <andr...@dqxtech.net> wrote:

> On Fri, Aug 11, 2017 at 12:01 AM, Devnuhl Unnamed <devn...@gmail.com>
> 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.
>
>
> > Other concerns fall around list() already being a difficult thing for
> people to understand
>
> I fail to understand what is difficult about it..
> And "destructuring" is a common concept in programming languages.
> https://www.startpage.com/do/search?query=destructuring&;
> cat=web&pl=chrome&language=english
> https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/
> Destructuring_assignment
>
> The following already works in Javascript:
> [a, b, c, d = 'else'] = ['aa', 'bb', 'cc'];
> I just tried it in my Chromium console.
>

Reply via email to