Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125441 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 13A321A00BD for ; Thu, 5 Sep 2024 19:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1725563150; bh=QKofvGzm/YQcGzaXm+Uu/7ldWiLOjN864ctIfrcSTfo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=VnZKlt6P41Pj7X2iBhxUuFAnc4vYNIV9nXeDQYH6UC2IhVVaefJsoBtX1920UyYUS frPIGec5kbfz41xZDH+hi1RXGHE34XQI6H5dCLX3vwGO3cbPpSEtB6zCdp9Yc2pANk MiYjDc+banji2Zu7+dmyFZC0Visq4pm7eYHv66MdNbfY6hvaqNGfZ9Jr1BBbeSMB0e TQ06ti8fXgGeISlznf9WSMl2nfdRJl5ZLLJC6u1dM/J2PkClOHM1L/OcUzKO7Q2tZR xAC/7cAZ/yvzeskFN+oXlnD12DXMefw2bW1pI1jOJHrsRwqIeTzSwZeJt367wqbg2g n4GDlWLUJVPpw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B78DB180032 for ; Thu, 5 Sep 2024 19:05:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from smtp-out3.simply.com (smtp-out3.simply.com [94.231.106.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 5 Sep 2024 19:05:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp.simply.com (Simply.com) with ESMTP id 4X080M5bw9z1FRmN for ; Thu, 5 Sep 2024 21:03:47 +0200 (CEST) Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by smtp.simply.com (Simply.com) with ESMTPSA id 4X080M35Ywz1DPk4 for ; Thu, 5 Sep 2024 21:03:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=givoni.dk; s=unoeuro; t=1725563027; bh=QKofvGzm/YQcGzaXm+Uu/7ldWiLOjN864ctIfrcSTfo=; h=References:In-Reply-To:From:Date:Subject:To:Cc; b=kFdMeRKn6pNVkguKehKtqAlRTbGjGIM3GfvNun7ZsNqeRLfglR7Z0nXcLCLyVg9zP /Dl/wy2LIgFQPiz//DUFOQPlmHho3UhA367XzEJEcH8YyHqpvf5409Gsn/7rpNLbpr tMxCMMCkRgh55OznDnyCGBfykMdR77CUYjT3DdRw= Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-e026a2238d8so1226237276.0 for ; Thu, 05 Sep 2024 12:03:47 -0700 (PDT) X-Gm-Message-State: AOJu0YzmtppQxUFHq2aJshTYsLpgw+eyLMUgBCNaG3+sYKeeNBUbwkFQ cSeBkdMGFVEN72dBA+Kc8Yz31uJ3jPjXwYVOr9i9hfkJDzl+SB14Y+8ADqbh/ZdfNk+xEqMVJM+ PNcbnMHaOXj9Iy+R1NOo2GV/uQEg= X-Google-Smtp-Source: AGHT+IFBCzCsUFYZkKXGrKr7UPcTN/9s6iyoST78OogyFBo6AATs7jp6Qy6l2bxpow2WFXxtnIfovjMhfp/g9Sx+WS0= X-Received: by 2002:a05:690c:dc6:b0:6b0:52a6:6515 with SMTP id 00721157ae682-6db44d6c4a8mr1936017b3.6.1725563026114; Thu, 05 Sep 2024 12:03:46 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <2716f729-4008-4f75-8412-861d8960b746@app.fastmail.com> <4f404d71-6581-44d6-8a87-dc6c605e0a60@app.fastmail.com> In-Reply-To: <4f404d71-6581-44d6-8a87-dc6c605e0a60@app.fastmail.com> Date: Thu, 5 Sep 2024 21:03:34 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PHP-DEV] function autoloading v4 RFC To: Rob Landers Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000359807062163f3f8" From: jakob@givoni.dk (Jakob Givoni) --000000000000359807062163f3f8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Sep 4, 2024 at 9:18=E2=80=AFPM Rob Landers wrot= e: > On Wed, Sep 4, 2024, at 17:16, Jakob Givoni wrote: > > > > 2. I've removed artificial restrictions on the constants in which all > functions that take them can accept both at the same time and behave > appropriately. > > > I'm not a big fan passing flags and using binary operations to combine > options into a single parameter. > It works, but it's opaque and old-school. > We have both named parameters and enums now, can't we just use those goin= g > forward, making each option a separate parameter or using enums with 3 > cases, FUNCTION, CLASS or BOTH? > > > Thank you for your opinion, but for cases like this, enums is probably on= e > of the worst choices IMHO. As mentioned towards the end of the RFC, I'd > like to add further support for other things, such as constants and strea= m > filters. Further, it appears that enums cannot be used in SPL (at least, = I > couldn't get it to link) due to SPL having a recursive dependency on > itself. This is what Gina's RFC seeks to rectify by breaking autoloading > out of SPL. This RFC focuses purely on function autoloading. > I see that under "Future scope" you put: > Potentially, constants and stream wrappers can be added in a similar > fashion. Trying to figure out if you are referring to the possibility of autoloading stream wrappers and constants? Is that something there's a need/desire for? In any case, it seems less than ideal to introduce a change to existing functions now only to change them again after Gina's RFC. Which means we'll be locked into binary flags even if enums (not even sure what you have against their use in this case) will be possible later. I also mentioned named parameters as an alternative, any thoughts on that? F.ex. changing one of your examples to: spl_autoload_call('func', function: true, class: true); // Calls both autoloaders with the name 'func' Best, Jakob --000000000000359807062163f3f8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, Sep 4, 2024 at 9:18=E2=80=AFP= M Rob Landers <rob@bottled.codes> wrote:
=
On Wed, Sep 4, 2024, at 17:16, Jakob Givoni wrote:
=
=C2=A0
2. I've removed artifi= cial restrictions on the constants in which all functions that take them ca= n accept both at the same time and behave appropriately.

I'm not a big fan passing flags and using binary oper= ations to=C2=A0combine options into a single parameter.=C2=A0
It works, but it's opaque and old-school.
We have both n= amed parameters and enums now, can't we just use those going forward, m= aking each option a separate parameter or using enums with 3 cases,=C2=A0FU= NCTION, CLASS or BOTH?=C2=A0

Thank you for your opinion, but for cases like this, enums is proba= bly one of the worst choices IMHO. As mentioned towards the end of the RFC,= I'd like to add further support for other things, such as constants an= d stream filters. Further, it appears that enums cannot be used in SPL (at = least, I couldn't get it to link) due to SPL having a recursive depende= ncy on itself. This is what Gina's RFC seeks to rectify by breaking aut= oloading out of SPL. This RFC focuses purely on function autoloading.
=

I see that under "Future = scope" you put:
Potentially, constants and stream wrappers can be added in a similar fashi= on.
Trying to figure out if you are referring to the possi= bility of=C2=A0autoloading stream wrappers and constants? Is that something= there's a need/desire for?

In any case, it se= ems less than ideal to introduce a change to existing functions now only to= change them again after Gina's RFC.=C2=A0
Which means we'= ;ll be locked into binary flags even if enums (not even sure what you have = against their use in this case) will be possible later.

I also mentioned named parameters as an alternative, any thoughts on = that?
F.ex. changing one of your examples to:

spl_autoload_call('func', function: true, class: true); // Ca= lls both autoloaders with the name 'func'

<= div>Best,
Jakob

--000000000000359807062163f3f8--