Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108480 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30996 invoked from network); 11 Feb 2020 15:05:43 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Feb 2020 15:05:43 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5DFC81804E6 for ; Tue, 11 Feb 2020 05:19:38 -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=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FREEMAIL_REPLY, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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, 11 Feb 2020 05:19:37 -0800 (PST) Received: by mail-lj1-f179.google.com with SMTP id d10so11525137ljl.9 for ; Tue, 11 Feb 2020 05:19:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hMidvZ8b845f4oF/s8kHhcIAj4VR+kvyUl7Y3BAcqXo=; b=DUM3ia1V1Uj8ONZ98Zmlvb+90YF0AgWyNeo1tM9MfU8/KU8Pjm+CaF4yuDHf+2yDdj 4lXN3loFElzTHopQHtHhFg+JilIjfFKKUCC1NUeU8BiqdwXKA6Dd8RSmQ3BgiVwVqo5v kaaGXyyxrlFPFuTrWT0gQCxA3Te7fB/fx28HLg4NMJB1NlhBurCCg3VpiHUi3ElKI/v8 YC9VuRxRozy+nJ//bXURVRZFQQyjoFmfeNiWL3t8w8KL7gza+oTJMYF9mYBFYrTtFRHt dVBtXGKIis5Vv2HDl68XHbval1IJXlj4tOPBjUOaq3kTXRtFYVLNOYd0a8dbbUoqGfpR 9C5w== 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=hMidvZ8b845f4oF/s8kHhcIAj4VR+kvyUl7Y3BAcqXo=; b=iLDZTl+tKSMge1qbggJE853XvNNQIDWpKPXBOzFkcqzYZoWRN9EKv2TPc60pFWGoT5 hKhQZcSglVmEbPDbRS+LvjucIDloEBda16A/uBkc1tJI1ILT6UCSxC+sbz8z3g/CVEYU 5XCvSxU/PVLsn4Opv/nKjT2jFSr5JDy1dlmLDD80sISyE2TYfxgHUe/90q2d4qOpPnw6 FpNShFK7Wv86V6+kEtXllSMDRvXp46OOYsu1kP6cL/1w0B+f4jNjBBfWgPHGKmfP8hTB Oni3UbzKhn6PsgnYlsvKr9+z29N3B+A6HcKqWXzl/qxQxHtmUBvIvLWJ/iseWoKdOJhd HDMw== X-Gm-Message-State: APjAAAVnSo7JSa4c1FgO4VNykiB3vvyaS1bC+ajluEdxrwkUEMH+Hitx gvT77nBRY/i+4si7seiwVJuceL9aMNFOWp8OxlU= X-Google-Smtp-Source: APXvYqzdr5Jo15qDMOEst//UjoxYvUXVzpZmqCZ+ljOXbJ+K8Lud6uob1PDL6kSWI0PiLrlEl9Ttbe2BaLpznA+oZ/4= X-Received: by 2002:a2e:2a84:: with SMTP id q126mr4171382ljq.258.1581427176213; Tue, 11 Feb 2020 05:19:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 11 Feb 2020 14:19:19 +0100 Message-ID: To: Manuel Canga Cc: Nicolas Grekas , Diogo Galvao , PHP Internals List Content-Type: multipart/alternative; boundary="0000000000001391c4059e4cb5f2" Subject: Re: [PHP-DEV] [RFC] From: nikita.ppv@gmail.com (Nikita Popov) --0000000000001391c4059e4cb5f2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 11, 2020 at 1:43 PM Manuel Canga wrote: > On Tue, 11 Feb 2020 at 13:16, Nicolas Grekas > wrote: > > > > > > > > Le mar. 11 f=C3=A9vr. 2020 =C3=A0 12:52, Diogo Galvao a =C3=A9crit > : > >> > >> On Tue, Feb 11, 2020 at 8:14 AM Manuel Canga > wrote: > >> > > >> > Hi internals, > >> > I Would like to present a possible new "::func resolution" for your > >> > consideration. > >> ... > >> > use function \My\I18N\i18n_translate; > >> > > >> > $mapped_array =3D array_map(i18n_translate::func, $array); > >> ... > >> > What is your opinion ? Do you see it useful ? > >> > >> I've wished for this on many occasions and think it'd be really useful= , > as long > >> as it could work with methods as well: > >> > >> $mapped_array =3D array_map(I18N::translate::function, $array); > >> > >> For what it's worth I guess it could just return [I18N::class, > 'translate']. > > > > > > I wish this would return a Closure instead, making $foo::function the > equivalent of Closure::fromCallable($foo). > > Hi, Nicolas, > > Currently, when ::class is used, class with > can or cannot exists in that moment. > Using ::func( or ::function ), I think > should keep the same behavior. > > Using ::func as alias of "Closure::fromCallable" check if function > exists in that moment. It is certainly useful, but, I think it's more > important be consistent > Checking whether the function exists is really unavoidable for functions, because you don't know whether namespace Foo; var_dump(strlen::function); refers to 'Foo\strlen' or 'strlen', without first trying to look up the former. I agree with Nicolas that this kind of feature would provide the most value if it created a Closure. This would circumvent all the issues outlined in https://wiki.php.net/rfc/consistent_callables. Regards, Nikita --0000000000001391c4059e4cb5f2--