Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114582 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 24081 invoked from network); 25 May 2021 10:49:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 May 2021 10:49:04 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C9B98180211 for ; Tue, 25 May 2021 04:00:18 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,SPF_NONE,URIBL_SBL,URIBL_SBL_A autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mx.kolabnow.com (mx.kolabnow.com [95.128.36.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 25 May 2021 04:00:18 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by ext-mx-out003.mykolab.com (Postfix) with ESMTP id CF1034090E for ; Tue, 25 May 2021 13:00:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-language:content-type :content-type:in-reply-to:mime-version:date:date:message-id:from :from:references:subject:subject:received:received:received; s= dkim20160331; t=1621940416; x=1623754817; bh=676zkps4oejXta7L5Yd YjOP9qHfgwpfJinTxjwN++zY=; b=pZIlXX+BoOKBi5Wus/BWUA37JipooE/MUYZ V2Jeu5CGa6nJF/1FV5C7FbQQWP3lHLDnzxfeyQB0pccdpvXoyA4jz/xoh+SqrCxj krSOBBCto/a/V6Rp+5/PL3nb4yscvMUaKzJzj04EqveBiumeoSGyjW/peu0EcJua 7THDr6zPxVK7dWs02ojrYV7QIAO1W8LL9hfwfISlXrqNZJFrFsr0eidhdVD8CEvO 3pcAoe4hx68lZMwwRwfhSGPPDn+EOQbgKqnhd0tmb7SpvGm39b8HNujdt0vpMWYa Q3hR307bH9nDWcdtXETD74NpOukLTTeqQSnZy1mkYhgmHOKw468iRZLn1fBHBK8Z 17cOT8HtlSgCc8upLyUwugvSPZmDTONnHg2B8yaWj/T7K4BfQAmV+yXDl5y2Cdkx i72lJK+NsrK7AngxFlyG04KoJDS3XP8h+DRG8HnAS043BageqoDLZcreGoo8eDxg EGq8q7UfbBcCCQRZ2oDkh2Ns86nUdGoUxneYrdzenfnedGLn0Tbk/ooMnQJCgS9d lL/VBb6EgTfOepwueMnxI6lXSqkRDczlk10rtKxpqYhzQWlLXA54wD6S2vSTwoTd UaAuGXXmoKgmQWltiJimBOuBISubrEEr9hIUmB3Cah3Q7uJCqT4C6M22erB0njKW b++5upP0= X-Virus-Scanned: amavisd-new at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out003.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GR-06Ivf7yab for ; Tue, 25 May 2021 13:00:16 +0200 (CEST) Received: from int-mx001.mykolab.com (unknown [10.9.13.1]) by ext-mx-out003.mykolab.com (Postfix) with ESMTPS id EBCED407BA for ; Tue, 25 May 2021 13:00:15 +0200 (CEST) Received: from ext-subm001.mykolab.com (unknown [10.9.6.1]) by int-mx001.mykolab.com (Postfix) with ESMTPS id F0F0924DC for ; Tue, 25 May 2021 13:00:14 +0200 (CEST) To: internals@lists.php.net References: Message-ID: Date: Tue, 25 May 2021 13:00:10 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] A little syntactic sugar on array_* function calls? From: alec@alec.pl (Aleksander Machniak) On 25.05.2021 12:40, Karoly Negyesi wrote: > $array->map($fn1)->filter($fn2) > > 1. It's longer. Much longer. > 2. It still requires knowing where the array goes. That's legacy which we > could sidestep with the arrow notation. > 3. Admittedly, the pipe is much more powerful. I agree. A unified object oriented interface to arrays (or strings for that matter) is not a new topic on this list. I guess you'd have to start with collecting all methods that would need to be implemented. First stage could be all array_* functions, but I can imagine others e.g. sorting functions to be included. > Once again, what I propose here wants to be a simple, cheap to implement, > narrow quickfix. I'm afraid it's much more complicated than you think. > (Although users can add array_foobar($array, $arg1...) for > $array->foobar($arg1) as they need.) I wouldn't go that far with this (possible BC break), maybe a future scope. -- Aleksander Machniak Kolab Groupware Developer [https://kolab.org] Roundcube Webmail Developer [https://roundcube.net] ---------------------------------------------------- PGP: 19359DC1 # Blog: https://kolabian.wordpress.com