Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100210 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87854 invoked from network); 14 Aug 2017 11:34:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2017 11:34:57 -0000 Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.46 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.46 mail-wm0-f46.google.com Received: from [74.125.82.46] ([74.125.82.46:35062] helo=mail-wm0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/F5-34801-FDA81995 for ; Mon, 14 Aug 2017 07:34:56 -0400 Received: by mail-wm0-f46.google.com with SMTP id m85so35344658wma.0 for ; Mon, 14 Aug 2017 04:34:55 -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=Zmo5eDgfLziMATV3Yw63OnrW3a9xHZsYqVcohuapD2o=; b=HH+R7U1PUcmVQbEaP0EubGz6sRrJr7rZDJpwUDkJ/g5/9P58qPJsbh+PpRUzhRUmxB dgaP95A4aLIiNIk7NlVnA2s10tJgZha5DkVdH5qMYvpqcUHUtXuZCKk2nPBivSdN1gdq ydfbU7gMzxmPtk74folpRjyCHY+x3iLmMo7+duvg/8TAM86ZsGz8ulJ77ftDqFPquAuQ Y9XdNMolPITWRiRDL/p10uDp7RyN/z6M4lzm5+/wLXx0gaW/cNxrnbrSKLbES+A4K+9M 3fNZvV7Iic1nLSrz29NYdtRoFuJc4EQoxlUcDtXUlxgXawLDot7s1N2RKIWW/o4bAbbs zFxg== 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=Zmo5eDgfLziMATV3Yw63OnrW3a9xHZsYqVcohuapD2o=; b=a7JUu8IdRbLcwviX7Yc2KKOI/fpSDevVftQLZiNosW6iRdimufLAsksHpXsO5Qq90+ IrrUaiseZcInQ+c8Tn6tp+YnX67FyPGTpj3aQnzeHOneqgZ/ABSydf1HgCWUcy2LWwQq FD+UhKZ0fmKRUx6moNjebm9jwaf7/rcQkDZvuDp0YysNeRs13wsw+KOn98UT5XFViDqf +bMBF4BgMAZ9lCNI3BzwcPYk7X8POS9FsBgv1IXpAl3EXgrqj6PSILMFLWYEK2Db5HZ2 edVMQnTkAoWuqo8bOaJ7nUbebYMz7OtAOg2hiGL5YHLZMCuT4Gr+zaClXCkEDhnEIebU Ir8A== X-Gm-Message-State: AHYfb5iEe+WenFyPbh71iFtWKGJ+ENZVvAjX1n0YmYgo45qk9qTs6bTB aCWG9s5BipS+kGTk88A4xSEZg1x6wg== X-Received: by 10.28.224.197 with SMTP id x188mr3449972wmg.99.1502710493174; Mon, 14 Aug 2017 04:34:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.135.186 with HTTP; Mon, 14 Aug 2017 04:34:32 -0700 (PDT) In-Reply-To: References: Date: Mon, 14 Aug 2017 13:34:32 +0200 Message-ID: To: =?UTF-8?Q?Bj=C3=B6rn_Larsson?= Cc: Andreas Hennings , Andreas Treichel , PHP internals Content-Type: multipart/alternative; boundary="001a1148f9702562c20556b50d15" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Allow default value in list() syntax From: ocramius@gmail.com (Marco Pivetta) --001a1148f9702562c20556b50d15 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > 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 Mon, Aug 14, 2017 at 11:35 AM, Bj=C3=B6rn Larsson wrote: > 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 >> temporary array. >> >> Whether this difference matters depends on the case. >> In my own philosophy, every code that I write to be reusable, could at >> some point be used in a situation where it is repeated a lot, and thus >> has a performance impact. So for my taste, it does matter. >> >> This said, I understand it not having the greatest priority. >> >> >> >> On Fri, Aug 11, 2017 at 7:46 PM, Andreas Treichel >> wrote: >> >>> You can merge the result with default values like this: >>> >>> [$foo, $bar, $foobar] =3D 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 >>> >>> One could argue that: > [$foo, $bar, $foobar =3D 1337] =3D explode(':', 'foo:bar'); > > is more readable. I find it a small but nice addition > that doesn't clutter the language. > > r//Bj=C3=B6rn > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a1148f9702562c20556b50d15--