Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100173 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33879 invoked from network); 10 Aug 2017 21:22:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Aug 2017 21:22:54 -0000 Authentication-Results: pb1.pair.com header.from=andreas@dqxtech.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=andreas@dqxtech.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain dqxtech.net from 209.85.223.178 cause and error) X-PHP-List-Original-Sender: andreas@dqxtech.net X-Host-Fingerprint: 209.85.223.178 mail-io0-f178.google.com Received: from [209.85.223.178] ([209.85.223.178:37319] helo=mail-io0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C9/41-34801-DAECC895 for ; Thu, 10 Aug 2017 17:22:54 -0400 Received: by mail-io0-f178.google.com with SMTP id c74so14095931iod.4 for ; Thu, 10 Aug 2017 14:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=L53OhsVvkXX/5jKgNjt8Yiy8JeHTSDvzvkP8/jJk8DU=; b=OfjetYqXE7xGZwk6sodxphiAMLtaz8qEzwvY2DphIvwJ+6FJMVTk4xRjktEEI1wxob kaMerIQjr9s1w9ESM6RuPok72AuoO252ODJRhHSPyAz0QQF82KEs8ukcuVOlhpOKV37f OBiKrp1PN+CAfa+kLR/Z4LU8OVQdxpEexO7167IS7e2hk/VjVmkMr3mBrHRco30mjiJv uTsT+P6N4+bUUadwoIFnI8e7Bo8C3KKSSThcLR6HU+OpC5I/S1MusWPK+gu3QKHRajIO QkWAdtXFq9v5edlVn+qWv8ThVFNYE1GQ/aYPh59E8kldxgg482m2fz5EvWj6h5TUtvpB J8Vw== 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; bh=L53OhsVvkXX/5jKgNjt8Yiy8JeHTSDvzvkP8/jJk8DU=; b=tOTReIpOHj6jYAO8HzZHq6dC7dnXEA81BnRTGf9QHUR/mYF4BH39axt1+ScGj34qr1 1qJ7VrhlFt6h0C+EtgtbFPtyFE3br5hMktYB27EB4+Mdc2GL2JzDuUNmHcndxM+8XeFE +5ghOsg8lleetUmpfV4HvGiAPLakPiWqmXo6N/+dwXHv0wsbxgI8K7IItGJPTIMCr7+e 46xYOOjrtsHpXvVQnLFuBTrdr06CzW/g3w/fxj0FMPrWwQ+08tiTVUWJirdX4VLNG0yN ICADxn1oLqxVctklcxHEtUtL5d7VTkl7YCLREJ95ChIj8/Uhm31472tl8CbqgsvOBPkc 6zCg== X-Gm-Message-State: AIVw1103QjgjMnq5v9JkBlyELDbUBYP9wu04E4TwmtzFTU/sulJRFi1m DEpm/atg2XzoR72pUbY= X-Received: by 10.107.163.9 with SMTP id m9mr961207ioe.194.1502400171258; Thu, 10 Aug 2017 14:22:51 -0700 (PDT) Received: from mail-it0-f54.google.com (mail-it0-f54.google.com. [209.85.214.54]) by smtp.googlemail.com with ESMTPSA id v65sm3647769itb.15.2017.08.10.14.22.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Aug 2017 14:22:50 -0700 (PDT) Received: by mail-it0-f54.google.com with SMTP id 76so19198163ith.0 for ; Thu, 10 Aug 2017 14:22:50 -0700 (PDT) X-Received: by 10.36.77.134 with SMTP id l128mr10624653itb.44.1502400170352; Thu, 10 Aug 2017 14:22:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.44.34 with HTTP; Thu, 10 Aug 2017 14:22:29 -0700 (PDT) In-Reply-To: References: Date: Thu, 10 Aug 2017 23:22:29 +0200 X-Gmail-Original-Message-ID: Message-ID: To: PHP internals , reeze@php.net, danack@basereality.com, devnuhl@gmail.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Allow default value in list() syntax From: andreas@dqxtech.net (Andreas Hennings) 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.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.) > > I regularly want this kind of feature when unpacking a string with explode(): > > list($prefix, $suffix = NULL) = explode(':', $string); > if (NULL !== $suffix) { > ... > } > > This is for situations where a string is coming from somewhere, we > hope it has the format "aaa:bbb", but we cannot be sure. > > Sometimes I use a workaround like this: > > list($prefix, $suffix) = explode(':', $string . ':'); > if ('' !== $suffix) { > ... > } > Which works, but means a new string will be allocated in memory. > > I find the list() with default values to be a decent and > understandable language feature. > > -- Andreas