Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114580 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20685 invoked from network); 25 May 2021 10:29:41 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 May 2021 10:29:41 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 51B161804B5 for ; Tue, 25 May 2021 03:40:52 -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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 25 May 2021 03:40:51 -0700 (PDT) Received: by mail-ej1-f43.google.com with SMTP id gb17so28516440ejc.8 for ; Tue, 25 May 2021 03:40:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=negyesi-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SyAInDac6mtvulCAsbXI5oYbQZFfHsJl4FbwkUj2oLE=; b=gaiJuNoV1/b8O4/zCkPJDB4YfTIh2nyX6QaQjufQoJYWbkunNSX3Tn9f+GOb1csp43 4PeXpqa6y+m3Cyg2sOFBt+XaSmk85xY90UPjpSWYPqrFXF+hf978mJPlTokrlGLCSLm5 tY/1Gz+gpffyNZOrtTbvv7acLVfK5C9Divw8eM0/NnOr8C70uU3OO5I5jGMH4W2amEhj 53nPM6XTdIzmGMwn/0lgLOY8sAvdqvOmnu+SxpTlgbIBM7uVHf6dpGy805RuMlu7Ld7B fckbbyAbHvXpiKohyuqY5lRqEA88rAuA4jZVht/EG82wlTJ9vP8cfHaF1Z5loGxCYWl4 Y/8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SyAInDac6mtvulCAsbXI5oYbQZFfHsJl4FbwkUj2oLE=; b=TIGorkH+KX5eyIuoPdm/bPQTG5Yjb6tdiNTJTj/AHfD0JoCBTmykpJlvKtoGXVWUtF L5nMkI9sUOpCwAcfDXlYBn/+2kNYS0zeRe5EnLjGBeOIltoj5NuA1EhwPExSB2xTIIOL VZzftBcGo766Y9myrqQNOAN+T5F9r+MUwEqOtzCS5Czfl4VlByyHH19jVsuQldhCyQYp QqiycpBbM0+XQlBIPfpXTkzNy3dZ6ITN8lj1+H8XbEXY2yaBCvSrcut8PkxYQMOPUPlq +VuT/pIwuafCnBYH6M7Vq8vrdQvmcsKKPe9GYx6hqb3XH4GWvcGDySPWMFFyiZgTQuX7 YSYw== X-Gm-Message-State: AOAM531I+mfPnlZ4ojGzkBG9/dbWKCg08QsztiM6JepgzlUh6xLwGqDD If7d4LNUnybDya8FVUT1yzi6qZTempcJ9Q== X-Google-Smtp-Source: ABdhPJxHeyyjLI52lSIBZAwfQfsa7RwUXuqspBXouegtDhXsD8zh+hmGP3up42093XwnfL215m59KA== X-Received: by 2002:a17:906:2e82:: with SMTP id o2mr28764209eji.388.1621939250140; Tue, 25 May 2021 03:40:50 -0700 (PDT) Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com. [209.85.218.48]) by smtp.gmail.com with ESMTPSA id w3sm3925822eds.78.2021.05.25.03.40.49 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 May 2021 03:40:49 -0700 (PDT) Received: by mail-ej1-f48.google.com with SMTP id z12so45099205ejw.0 for ; Tue, 25 May 2021 03:40:49 -0700 (PDT) X-Received: by 2002:a17:906:e210:: with SMTP id gf16mr28455532ejb.472.1621939249074; Tue, 25 May 2021 03:40:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 25 May 2021 03:40:37 -0700 X-Gmail-Original-Message-ID: Message-ID: To: someniatko , ocramius@gmail.com Cc: Lynn , "internals@lists.php.net" Content-Type: multipart/alternative; boundary="000000000000c9d7f205c325284f" Subject: Re: [PHP-DEV] A little syntactic sugar on array_* function calls? From: karoly@negyesi.net (Karoly Negyesi) --000000000000c9d7f205c325284f Content-Type: text/plain; charset="UTF-8" Thanks for your quick feedback everyone. On Tue, May 25, 2021 at 3:22 AM someniatko wrote: > > The pipe operator feels like a poor solution while `->` would do exactly > what people want. > > Could you elaborate? Adding method-like array access functions with > only few predefined functions, and only for arrays looks very limited > That is probably because it is very limited :) deliberately so. The proposed syntax $array |> array_map($fn1, ?) |> array_filter(?, $fn2) When I compare to: $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. But why not both :) ? Also, it would require accepting two RFCs although of course mine would need to become an RFC too and longer term this is not a problem. scalar_objects are wonderful. It's a space rocket compared to my wheelbarrow. If it flies , mine is obviously moot. However, a wheelbarrow is much cheaper and quicker to construct than a spaceship :D Once again, what I propose here wants to be a simple, cheap to implement, narrow quickfix. (Although users can add array_foobar($array, $arg1...) for $array->foobar($arg1) as they need.) Karoly Negyesi --000000000000c9d7f205c325284f--