Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112201 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82303 invoked from network); 8 Nov 2020 00:20:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Nov 2020 00:20:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9C9331804C3 for ; Sat, 7 Nov 2020 15:41:45 -0800 (PST) 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.3 required=5.0 tests=BAYES_50, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (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 ; Sat, 7 Nov 2020 15:41:41 -0800 (PST) Received: by mail-qt1-f174.google.com with SMTP id h12so3566581qtc.9 for ; Sat, 07 Nov 2020 15:41:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:from:date:message-id :subject:to; bh=4EaEFmpe0QrvIyqvsS8W8pnIIRS+dgytERrStn+ey/I=; b=kMknNwXC6GH+VdkfPMsGzdBI0BWCyh9HKVrXPiE/L7s+yAUplmFolP/vubiphlGB3k 0hHk4GosR9tfMt0owPF1MHIDSsEPSSmtFY/wibKSUftBePKDH4vTnAlZxcAcyFJYJr2D aacOjGHYZK1ccAB4uDIRySzJb04qabvxt8g/ceKBkyTSdMn2ZeJ8x2iAz2FRy3lDSuwV rIiACaCzafq3LSKxIpeNxEW2sAQ5VdPuoX4b8QpNEFcLcCAzsRHe6uDdsHTLYNtk17iI rXN4szIKcy/suKj0QbJqaWPCjQzGfRRLGp2SSkj5a5FNjkfAU11rmPOHy7nYm44ItZN6 GPjQ== X-Gm-Message-State: AOAM533LyfGS2LjjzPCJoZT0CumS7mSNknMfITwpkgfBBr42aP4lmdW4 vZNvVy7rHKjSLkZ+i5C1CY1XvNNcLhA= X-Google-Smtp-Source: ABdhPJzHj0XC6YV51UyFffSZN4vwZlos5zV3TTEl2pD6muH5oJe4ny0jSRjX+oUiHY173AIlJVsOZA== X-Received: by 2002:ac8:7245:: with SMTP id l5mr7612256qtp.258.1604792498757; Sat, 07 Nov 2020 15:41:38 -0800 (PST) Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com. [209.85.219.174]) by smtp.gmail.com with ESMTPSA id g1sm3199575qtp.74.2020.11.07.15.41.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 07 Nov 2020 15:41:38 -0800 (PST) Received: by mail-yb1-f174.google.com with SMTP id m188so4671498ybf.2 for ; Sat, 07 Nov 2020 15:41:38 -0800 (PST) X-Received: by 2002:a5b:389:: with SMTP id k9mr10435313ybp.75.1604792498051; Sat, 07 Nov 2020 15:41:38 -0800 (PST) MIME-Version: 1.0 Reply-To: as@php.net Date: Sat, 7 Nov 2020 18:41:22 -0500 X-Gmail-Original-Message-ID: Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000c8dfcd05b38cde55" Subject: [RFC] Support for ::function syntax From: as@php.net --000000000000c8dfcd05b38cde55 Content-Type: text/plain; charset="UTF-8" Hello internals, Looking for feedback on the idea of supporting `::function` syntax (or `::fn`) for consistency with existing `::class` syntax: $arr = ['apple']; print_r(array_map(strtoupper::function, $arr)); (Apologies if this has already been discussed. Hard to search for colon-colon-function.) Benefits in my view are readability and potential use in static analysis. Downsides (as implemented in proof-of-concept) are that it can be needlessly littered in a lot of places, and that it breaks class consts named `function`. I'd vote against it in its current state, but if people like the general idea maybe the drawbacks can be addressed with a better implementation. Examples: https://gist.github.com/adsr/2c0b9243986418af3cecf8046657304b Proof-of-concept: https://github.com/adsr/php-src/commit/07bb24243022ccef5823f6977d231f3535a48a07.patch Adam --000000000000c8dfcd05b38cde55--