Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100185 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 862 invoked from network); 11 Aug 2017 14:18:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2017 14:18:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=devnuhl@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=devnuhl@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.182 as permitted sender) X-PHP-List-Original-Sender: devnuhl@gmail.com X-Host-Fingerprint: 209.85.161.182 mail-yw0-f182.google.com Received: from [209.85.161.182] ([209.85.161.182:33115] helo=mail-yw0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C5/57-34801-9BCBD895 for ; Fri, 11 Aug 2017 10:18:34 -0400 Received: by mail-yw0-f182.google.com with SMTP id p68so23130153ywg.0 for ; Fri, 11 Aug 2017 07:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=1+IWLStsUJz8F9ayhsBmxx7aoQBf6aKtIakxAi+Nt7c=; b=WE0FNMhnTm2mCwSh5GsHzyWOo/UOnKRF/AYdXpJwgw6dB/y8LpEc0gjMfTqhsPGwFw 5aZGNkruj4044kugWsB4loqVrzg+JrzxxbPrF0MUlMqXivtSgwTeyTb9H46al2wv2cus vXbGhXBNbAOxQKde8A2DYvz5EkU8a9lcVSLgpi3s1x7qngO+px18/qbbIbrjcRnYnyGH iADX4UbIz0kcBu2cwZ0lmEDkLL3efelCPg9Vs9SLkuA+nqc5idommgWQIkfstBojdzgj gsw7X9ybkPUoD3hJ6k8yMM/b1bBjEoouD4YGH+HOI9eYkmHGMayjh+HBNugVZJbdAXtF GvqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1+IWLStsUJz8F9ayhsBmxx7aoQBf6aKtIakxAi+Nt7c=; b=hkYka0QyPuXHSHXhJ8h6bHhz8ze/yQwcHi/PgXnyItjNyhzGruau13LzEGKrqQaePR X8+OAxe0V26thisX6W8x6CsJ6NZsLwB9bbHVqD5XlYjPIQbJ/ZyrnxC0ecmPqlNOPOBR j4pnoNbIT68zIauw+02JMQkyTWqIHd8RUv7QiUvaR/Pd+IxrIPDCfFaNdmxhF5TxMnL3 uyBIYjW7Oofm0SHoYyFl4y/wWppPYmnjAvmwlHjsMb98tAfvE425RSFIsy0KYWqAD2VT dWKPRjQOK0Ul7KbUuvES3x/IpllzHaR1NFkH8IWIqten+b9VsdymGTGvb07nAO5fWOnD losw== X-Gm-Message-State: AHYfb5jNsGt/JiGpLet9jMvZeen1BvtbL1B4/9LzVr1KMev7cAEJTx+u 3agaMUUIx/TTOOdfQpDXETewqrmpQg== X-Received: by 10.129.115.67 with SMTP id o64mr13171055ywc.154.1502461110735; Fri, 11 Aug 2017 07:18:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.126.131 with HTTP; Fri, 11 Aug 2017 07:18:30 -0700 (PDT) Received: by 10.37.126.131 with HTTP; Fri, 11 Aug 2017 07:18:30 -0700 (PDT) In-Reply-To: References: Date: Fri, 11 Aug 2017 09:18:30 -0500 Message-ID: To: Andreas Hennings Cc: reeze@php.net, Dan Ackroyd , PHP internals , Sara Golemon Content-Type: multipart/alternative; boundary="001a11493714cb58cf05567afc83" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Allow default value in list() syntax From: devnuhl@gmail.com (Devnuhl Unnamed) --001a11493714cb58cf05567afc83 Content-Type: text/plain; charset="UTF-8" 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" wrote: > 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. > > > > 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. > --001a11493714cb58cf05567afc83--