Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115193 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31386 invoked from network); 28 Jun 2021 20:08:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Jun 2021 20:08:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4F560180502 for ; Mon, 28 Jun 2021 13:28:38 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 ; Mon, 28 Jun 2021 13:28:37 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id q4so19224541ljp.13 for ; Mon, 28 Jun 2021 13:28:37 -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:content-transfer-encoding; bh=IuhrAcB8ZxPg5TFNVIhgBQAW/SIGaP869o7agfHQBpM=; b=G669yJpfBdKu9jkgJv4V+qs+BW64GeIOmfAvDbm5/ad57Tzu3Dfw98vuzL4UPNC9+R uYNk7kOarCT1sFSatqR5N8/VuNUMCehnHQJfwuG8fu2Q7zrbz9TfcszsVTIrGFuLlarz Nh88slL84IwftCst9WhmHVURLqd9suwsw3VZR08pEkAxsb6i/CsJVKa+PunSl6SMKCFm ageXtgNDN2jXlT8M/Kk3irtVqhsOyjHk2WCCJx9E2KgJQAAfbQG1XdjI+beZ7kCavlfo t9grVQwvX2kaZEidpgL3+lgHZWhCD/I5uPyTJe+JYOK5ze4FhTVBoRWbBivRtpCoS7TM YRnw== 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:content-transfer-encoding; bh=IuhrAcB8ZxPg5TFNVIhgBQAW/SIGaP869o7agfHQBpM=; b=V/TLvDh4Id/sowEeI8a17qptUMSiD73UBZm7yvvBHFptaAyNLExtcRsEK4leUagXFy Q8sqHB/yT7ZDHiwhbWsgEnNDZnKF5in6GjHVYfGPb+OFO9l8NX6swHXMW3mWUpFZwhP+ rU2dCtAKwbwbfU2WS7oZDDhIwUPHPWX8GZw+iIbRkE0s1GVVUNJ7wS7A7+psFfQbIpqo 1sKLoT3ETdSqLDYSuHqmBspnATfVabaEgfNBF2UQFFIRpBIQmRU/s0ckghdn/0ZddOom +pkDyIE8pTcA4ImbqKHFG86tWLYd4sO/lbgbNolelQCyWWCxWdXB8xsaPHuxsrg+7ayx Z36A== X-Gm-Message-State: AOAM531jpOb/+ZqFXStL6zXoXcii6rhCXEreXU8cmU9wFemYFA9OyWz9 3ogvrEY01QAIguELEQmwL4mcvh/n979MnpoNAEc= X-Google-Smtp-Source: ABdhPJw82r7IXgPtVnRjQt+xoBYDj0AjlKxgjn5icVTC5unx6nbLvZLh9PcwseJQZbe5vvVxfc3sOrEEm/sHbHwEwyA= X-Received: by 2002:a2e:8e75:: with SMTP id t21mr935287ljk.71.1624912116310; Mon, 28 Jun 2021 13:28:36 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:7506:0:0:0:0:0 with HTTP; Mon, 28 Jun 2021 13:28:35 -0700 (PDT) In-Reply-To: References: Date: Mon, 28 Jun 2021 22:28:35 +0200 Message-ID: To: Rowan Tommins Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Pipe Operator, take 2 From: olleharstedt@gmail.com (=?UTF-8?Q?Olle_H=C3=A4rstedt?=) 2021-06-28 22:04 GMT+02:00, Rowan Tommins : > On 28/06/2021 20:25, Olle H=C3=A4rstedt wrote: >> Usage (ignoring the pesky undefined constant warnings ><): > > > Unfortunately, you can't ignore those warnings; not least because > they're fatal errors in PHP 8, as they frankly should have been in PHP 3. > > You can use our current ugly callable syntax (strings and two-element > arrays); you can tackle the complexity of unifying functions with > constants, and methods with properties (as Levi explained in the other > thread); or you can add a dedicated callable syntax, which the PFA > proposal gets us with bells on. Sorry for hijacking the thread, but are there no other alternatives, really? Just brainstorming: 1) Setting to silence the warning. Probably frowned upon, AND requires that functions/methods are case sensitive, which they are not right now. BUT, constants are always case sensitive since 7.3, so the risk of collision is not that high...? Assuming constants are by convention always UPPER_CASE, and functions either snake_case or camelCase. You can argue that the setting together with a CI to check cases would be reasonably safe. 2) Setting to silence the warning IF and only if argument expects a callable, like in array_map (won't work with a pipe() function, though, since pipe() would take any number of arguments and that can't be typed) 3) Silence the warning if you type-case explicitly, like in `pipe($start, (callable) htmlentities);`. Another alternative is `(fn)` as a type-cast. Not much better than `pipe($start, htmlentities(?))`, I guess. Just different style. 4) Silence the warning ONLY when it's the right-hand argument to pipe operator, like `$start |> str_len`. All stupid?