Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99855 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59368 invoked from network); 12 Jul 2017 12:20:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jul 2017 12:20:19 -0000 Authentication-Results: pb1.pair.com header.from=krukowski.bartlomiej@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=krukowski.bartlomiej@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.181 as permitted sender) X-PHP-List-Original-Sender: krukowski.bartlomiej@gmail.com X-Host-Fingerprint: 209.85.220.181 mail-qk0-f181.google.com Received: from [209.85.220.181] ([209.85.220.181:32933] helo=mail-qk0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/B5-01782-00416695 for ; Wed, 12 Jul 2017 08:20:17 -0400 Received: by mail-qk0-f181.google.com with SMTP id a66so6267633qkb.0 for ; Wed, 12 Jul 2017 05:20:16 -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=iBjERJgDu8Koa60FXOaXbQ3lim0CwDRXVGaI5na8me4=; b=bPxGI4Gz51GTCwD3ZX0hZanPuqAmqaEmb4h4D5IHgYVNQa7gRWyWKsVsRx/8HaVUjq vLDXo7QdYDNBB9fwQu9ELUL1sl9efaW4/nE/N3d7fQn8bUZoL0hEM9IB9+NG4G/kOgAt c2Tvutp1HNhSPb1FiwL6czd3cF39eYHBnckQIZ4DAD6rZdvygt+U0DyJ1yf2JCDuedjQ iQ85wloWBi2GiLOrqzE5YoFIvY5pIdwyfR4XJvOFZ3wQ76nEvvhXwjvtQzEBaObBgmuV C9tEzZzo+QtIlWmomnxUD6FMTzyGgHixj8jEkrXDc2a6zH6RrpSb1DOsNwBhrWJgQvpL Ky7A== 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=iBjERJgDu8Koa60FXOaXbQ3lim0CwDRXVGaI5na8me4=; b=pEsiucnZk5p+CSDDLXkPFUvI4IEWwfnBT+ZXPuIQ7NXGSEeJgGV3VMQIg1z6u9Y/7R QJelZJIUr2u9gisg6991OPYMLnoqtO6B11lyCawnTPDWVknIwYp8Z2MZ+enScXGz7ikk Yl2R12to8EbkTkLIhTHwwk15idYqRX8spOJT4g1gvc5y1zioRDkjhXnYUEVPagYHMSQ5 tOVQR8oNOlZ7jIKU/PiQdCa3GnrqtOp50JmjHA8T/dsDfjlkxL1jsZizp+stLNgt45mU U6450exJEF6R0wALBnzKN7o8SGrpcYeEPP3zhu5bB/jrfbpVrDWKqsumZX8VnrN6ha1N raOQ== X-Gm-Message-State: AIVw1113/FTibyiKvW/jT5f5BiccxK7SzMifeubBk37oVPwkUJgQafsE rye69p8/0RonR1xS1/K/KQzQT0EeWg== X-Received: by 10.200.34.129 with SMTP id f1mr6051217qta.183.1499862013504; Wed, 12 Jul 2017 05:20:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.152.18 with HTTP; Wed, 12 Jul 2017 05:19:53 -0700 (PDT) In-Reply-To: References: Date: Wed, 12 Jul 2017 14:19:53 +0200 Message-ID: To: Marco Pivetta Cc: PHP Internals List Content-Type: multipart/alternative; boundary="001a11393f3c86f26c05541dd6ae" Subject: Re: [PHP-DEV] RFC proposal - unpack iterator From: krukowski.bartlomiej@gmail.com (=?UTF-8?Q?Bart=C5=82omiej_Krukowski?=) --001a11393f3c86f26c05541dd6ae Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > so that I can use functional composition instead of operators > (`array_map('...', $values))`). I think I do not understand. Still, the addition is very nice and complimentary with the existing > splat/variadic argument stuff :D So can I create RFC? :) 2017-07-12 14:12 GMT+02:00 Marco Pivetta : > On Wed, Jul 12, 2017 at 2:09 PM, Bart=C5=82omiej Krukowski < > krukowski.bartlomiej@gmail.com> wrote: > >> Hello, >> >> Yes, this is exactly what I would like to achieve. >> >> Best regards >> >> 2017-07-12 14:06 GMT+02:00 Marco Pivetta : >> >>> On Wed, Jul 12, 2017 at 11:22 AM, Bart=C5=82omiej Krukowski < >>> krukowski.bartlomiej@gmail.com> wrote: >>> >>>> Hello, >>>> From PHP 5.6 we have possibility to add variadic functions and unpacki= ng >>>> arrays via *...* >>>> Would be nice to extend responsibility of *...*. Sometimes in code I c= an >>>> find lines similar to the following: >>>> >>>> $result =3D array_merge(['some value'], ['some other value'], $array); >>>> >>>> >>>> I would like to shorten this line to the following: >>>> >>>> $result =3D ['some value', ['some other value'], ...$array]; >>>> >>>> >>>> And even allow to unpack more than one array: >>>> >>>> $result =3D ['some value', ['some other value'], ...$array, >>>> ...$secondArray]; >>>> >>>> >>>> Using new operator we can produce shorter and more clearable code. I >>>> would >>>> like to create RFC for my proposal. If you think idea can be useful, >>>> please >>>> give me an access for creating RFC. >>>> >>>> Best regards >>>> >>> >>> Would this allow operations such as the following one? >>> >>> $a =3D [0]; >>> $b =3D [1]; >>> $otherArrays =3D [[2,3], [4,5]]; >>> $mergeAll =3D [...$a, ...$b, ...[...$otherArrays]]; // [0, 1, 2, 3, 4, = 5] >>> >>> Marco Pivetta >>> >>> http://twitter.com/Ocramius >>> >>> http://ocramius.github.com/ >>> >>> >>> >> > TBH, I'd like to have a functional approach to this, so that I can use > functional composition instead of operators (`array_map('...', $values))`= ). > > Still, the addition is very nice and complimentary with the existing > splat/variadic argument stuff :D > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > --001a11393f3c86f26c05541dd6ae--