Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125450 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 9E10F1A00BD for ; Fri, 6 Sep 2024 11:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1725623096; bh=CQfpdr0MngOLoUjfibw8h+gikhPV0cb9k6Vehuc8eyc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=B4pgiOgm1oRtBnoIaIRER578TvG3WJEKNTc95EFGuejxH4w3Uq/akIYLa/m0AwO2N /NFsuAZmFCmhFfKfqURZ7yvrfzHWfbqZgtRBF2+ohco/1N15KPYuklB4xIfaQnajIL bqcdwtmgmWXik2tB8FSjVbgFBvZfi8wsBVg4fU04fxWKlYBczmNHle1u7TXh4TwitE PgcNDkEe8m0Hi7t92Fk61Br6SSKUbKmfsnx6cf6ufN0N1n+6YtHYLpIFfPjKt/3gpX ++Z8+2Ur9iSuklBXZ2ryAl6zKGDijpIMiMcshmusX8MotxyH2DmCGi55+Flei3U6t3 ZFe7xVOSyPpQg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D635818007E for ; Fri, 6 Sep 2024 11:44:53 +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)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 6 Sep 2024 11:44:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp.simply.com (Simply.com) with ESMTP id 4X0Z9716wLz1DNGc for ; Fri, 6 Sep 2024 13:42:51 +0200 (CEST) Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) (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 4X0Z965sC0z1DR3W for ; Fri, 6 Sep 2024 13:42:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=givoni.dk; s=unoeuro; t=1725622971; bh=CQfpdr0MngOLoUjfibw8h+gikhPV0cb9k6Vehuc8eyc=; h=References:In-Reply-To:From:Date:Subject:To:Cc; b=GXyo1MqWI8/10/xRDGnhcgbKRlvrEqpk3DqWtoE5Ak6c5pXCnJNnaVFKHpYDdSskG co3ofsx8uN8og/3juv7RcV7iLYaZSnj6dWEjQ0zdvqU52nUejZuMC+ASNV+3wChKlZ JZYDqWoacsIreV+r9ceQp0/9CPL+ABB7zjgwizKU= Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-68518bc1407so21152647b3.2 for ; Fri, 06 Sep 2024 04:42:50 -0700 (PDT) X-Gm-Message-State: AOJu0YylnFUpOJ+/elkd/miZKvUkSmpdZFZ6yIgpKhNn1T6EdFzQmSLB W9iIPeBmIL3cNU65djBvfyK2AAvVFwjS+Xp/KfEkk7xNEZJRd+ea1PdDOmtKbfnuYHbH3ZJoSdq PK+Mhj8hGkS+84AYUnUli1q+iEdI= X-Google-Smtp-Source: AGHT+IHGpAz6DLFUp7U4b0wIWtq3gdeNrdCLjfNahRtjyo7osGq1sohp62ktKm3dvZ2cxxw6rM0zG+57X/y0eIHTxoM= X-Received: by 2002:a05:690c:67c6:b0:685:3ca1:b9d8 with SMTP id 00721157ae682-6db451544bcmr28928057b3.30.1725622969668; Fri, 06 Sep 2024 04:42:49 -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: Date: Fri, 6 Sep 2024 13:42:38 +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="0000000000001fa48c062171e85f" From: jakob@givoni.dk (Jakob Givoni) --0000000000001fa48c062171e85f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Sep 5, 2024 at 10:58=E2=80=AFPM Rob Landers wro= te: > On Thu, Sep 5, 2024, at 21:03, Jakob Givoni wrote: > > > > On Wed, Sep 4, 2024 at 9:18=E2=80=AFPM Rob Landers wr= ote: > > > 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? > > > Hey Jakob, > > I'm replying this in a separate thread because it is more or less 'meta' > than my other reply. There have been discussions about this off-and-on fo= r > awhile, but the gist is that there are people that would find it useful. > For example, in my experimental "time" library there is a SECOND and MINU= TE > constant that must be required if you have the library, even if your code > execution path never uses them. So, I think there might be some usefulnes= s > to constant autoloading. Further, there are some great async libraries th= at > use stream wrappers to hijack/use file_get_contents and friends in an asy= nc > way, so having autoloading there may also be useful. > Ok, I had not thought about it, but it makes sense. Thanks for the explanation! > > That being said, I wanted to constrain the scope initially as this > appeared to be a hot topic (autoloading functions) every time it came up. > Thus I was preparing myself for a long and drawn-out discussion and kept > the scope minimal. > > I hope that helps explain why it is under future scope. > > =E2=80=94 Rob > --0000000000001fa48c062171e85f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Sep 5, 2024 at 10:58=E2=80=AF= PM Rob Landers <rob@bottled.codes> wrote:
<= /u>
On Thu, Sep 5, 2024, at 21:03, Jakob Givoni wrote:


On Wed, Sep 4,= 2024 at 9:18=E2=80=AFPM Rob Landers <rob@bottled.codes> wrote:

On Wed= , Sep 4, 2024, at 17:16, Jakob Givoni wrote:
=C2=A0
2. I've remove= d 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 bin= ary operations to=C2=A0combine options into a single parameter.=C2=A0
It works, but it's opaque and old-school.
We hav= e both named parameters and enums now, can't we just use those going fo= rward, making each option a separate parameter or using enums with 3 cases,= =C2=A0FUNCTION, CLASS or BOTH?=C2=A0

Thank you for your opinion, but for cases like this, enums = is probably 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 cons= tants and 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= dependency on itself. This is what Gina's RFC seeks to rectify by brea= king autoloading out of SPL. This RFC focuses purely on function autoloadin= g.

I see that under &= quot;Future scope" you put:
Poten= tially, constants and stream wrappers can be added in a similar fashion.
Trying to figure out if you are referring to the possibi= lity of=C2=A0autoloading stream wrappers and constants? Is that something t= here's a need/desire for?

Hey Jakob,

I'm replying this in a= separate thread because it is more or less 'meta' than my other re= ply. There have been discussions about this off-and-on for awhile, but the = gist is that there are people that would find it useful. For example, in my= experimental "time" library there is a SECOND and MINUTE constan= t that must be required if you have the library, even if your code executio= n path never uses them. So, I think there might be some usefulness to const= ant autoloading. Further, there are some great async libraries that use str= eam wrappers to hijack/use file_get_contents and friends in an async way, s= o having autoloading there may also be useful.

Ok, I had not thought about it, but it makes sens= e. Thanks for the explanation!
=C2=A0

That being said, I wanted to constrain the scope= initially as this appeared to be a hot topic (autoloading functions) every= time it came up. Thus I was preparing myself for a long and drawn-out disc= ussion and kept the scope minimal.

I hope that= helps explain why it is under future scope.

=E2=80=94 Rob
--0000000000001fa48c062171e85f--