Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123875 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 9AA481A009C for ; Wed, 26 Jun 2024 18:05:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719425202; bh=Xih48ba/hnv4p9+vGUG3tPBFl+F4fuDPkPeheJVbREw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=frCraFSVwWr3DZ8QMKf1ktcTLW+dCTPPrkYkkMIn31YJh/+BnsoP8j14edy5DaKk6 ace7/CYbJNILt4uPeSPjhB5p8ZRCM5HNKrxxq8nupWA/zpy4aIx7+AtdFY3HPcb47S x7da5hWWEJmNgAuv7k41neGZD/9HHiikCmTCpYnb9rnxleG3L3X22kpHFrAF4nrm5i wp2wcwmXw5njcSsp1xJMOxkMcHMQVu0GlrWTJ3tI+z7wLkILhhu5uZKxu2awCMl/SS 1xmIp1CJ7d6UG/OqUb5wWe0qPvYJSOHzw+l8hAqOfcr4+vJfsqIqYyCY0N3wOjBDFa f6UjceEvnF/zA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 74B85180887 for ; Wed, 26 Jun 2024 18:06:40 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.51]) (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 ; Wed, 26 Jun 2024 18:06:36 +0000 (UTC) Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-25d584e9fe6so561380fac.1 for ; Wed, 26 Jun 2024 11:05:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719425118; x=1720029918; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Xih48ba/hnv4p9+vGUG3tPBFl+F4fuDPkPeheJVbREw=; b=U7kMTP5X1W2buVvax6joMsP03ifLSj2gs5tcz9qzc/itUqNNv+t23juUytq/vzz0Eo XqmjSSA9rtfxSMf95kkWq8XsHXwP9bxnla+MM5y3SjABb4M0jCs10h2YyErAIV9kzGjf 6IbKCXBgv4+gryAb+jtZ3hXl3hTG0bCEpTFrz8ZFqBqgGZrVwsaPuYXmGeuw0EefdGKp kZFw4lY6fVP7C5SbQLG5Y8AJazmOtLCT2AhecAX6qvrjopyfa4SwpfbNs3CdU9GkFgej ANECD8fPRVzlJEBnGTSEvtkMGdH4KUnwzNNQhh/iAowXELXN/ZmR/s/CFb430XPTXKwO Q4wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719425118; x=1720029918; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Xih48ba/hnv4p9+vGUG3tPBFl+F4fuDPkPeheJVbREw=; b=BdX0gPZF4Dxl4ydXB0ze0rY7y9LZfhpWieZTW3xH+iLq8Q6g/bIoBKRoSjIL9as/L4 SM/61H+rUNrGfGV+oeZ49g+RbMbT9yuDgQy+UzO3xjHqjBaHFLfL9XI4/gjuNOs/lhwG G0jKN/oZfmapE6+x48EQnb2kAB8SpUKt8issG6afPpByroL4MZd9Ayoh77OHzB59I8no L3JXhzqmpTclUwgrRdt7rMWG/Wlj6eb0soZCeE2PbqtjrZg0SyDAcV5Evy+3DnwE/zgn zomOulMF2TCIJOO5vdluCHjD3Y2Zry190MspmiYLA8JnFBOZaLsm/O07ER5V1cEDjfTp /UgQ== X-Forwarded-Encrypted: i=1; AJvYcCWipco1vRXHS9KGvxuani+ZVkuuUEx/3l9U59IMyBBuupzixrURhdi5ZxOMmGZWHZwGk7XI0/th2aChIM/sQQcgSw2ySulpZg== X-Gm-Message-State: AOJu0YxLtiEbkN/z31OaYFCYQQekHvkO26h4GlK99kXvVBRT81D8/793 UHp5xtaWG0MM+lzChUyTYujOBtfm0MD7PEIz0cq+B7t7c0DuGDBxMfOI3cMdArtGbYRGXnxncdB 843rIRV197QPbt9P3t21Qx6zjFMzjHi3hi6Trwq5s X-Google-Smtp-Source: AGHT+IHusE962He6F91wwijr0ijROkjmFvht3OGel9xoH3Ia05yuZKhNmNHaLU4HnbhLIaNq6fgysZw4Ep+1By6m36U= X-Received: by 2002:a05:6870:224f:b0:258:3159:f489 with SMTP id 586e51a60fabf-25d06b6fad3mr11748890fac.9.1719425118288; Wed, 26 Jun 2024 11:05:18 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <4596aa73-cfd4-2292-7191-2839a5bab695@php.net> In-Reply-To: <4596aa73-cfd4-2292-7191-2839a5bab695@php.net> Date: Wed, 26 Jun 2024 12:05:09 -0600 Message-ID: Subject: Re: [PHP-DEV] [RFC] Static class To: Derick Rethans Cc: Larry Garfield , php internals Content-Type: multipart/alternative; boundary="00000000000064c5f3061bcedbe2" From: lnearwaju@gmail.com (Lanre) --00000000000064c5f3061bcedbe2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable In JavaScript/Typescript, we can declare functions that are local to the current file by not exporting them. In C/C++ this is achieved by simply writing the function in the implementation file as opposed to the header. However, achieving a similar level of privacy in PHP requires using private static methods, or else you incur the overhead of creating an object for stateless functions. How do you propose handling such cases using namespaced functions? Can you think of any scenarios where hiding non-API functions might be necessary? I'm curious why you keep returning to namespaced functions when they don't fulfill the same role. Cheers, Lanre On Tue, Jun 25, 2024 at 9:20=E2=80=AFAM Derick Rethans wro= te: > On Sun, 23 Jun 2024, Larry Garfield wrote: > > > On Sun, Jun 23, 2024, at 6:10 PM, Bilge wrote: > > > Hi Internals! > > > > > > I am pleased to present my first RFC: Static class > > > . > > > > > > This work is based on the previous discussion thread on this list of > the > > > same name, and hopefully captured all the relevant details, > > > notwithstanding anything unanticipated that may present itself during > > > the implementation. Let me know if you feel anything important has > been > > > missed. I am aware it omits to mention specifics about messages so > > > emitted when runtime or compile-time errors occur, but I anticipate > this > > > can be hashed out in the PR, unless consensus indicates otherwise. > > > > > > I am aware this idea is not supported by everyone, but there seemed t= o > > > be enough positive voices for it to be worth a shot. I'd like to get = a > > > better idea of where people might stand when it comes down to a vote, > > > now there is a formal RFC, so we know whether it's worth completing > the > > > implementation, although any sentiments so proffered are of course no= t > a > > > commitment to vote any particular way and nobody should feel compelle= d > > > to speak to that unless comfortable. Looking forward to feedback! > > > > > > For the record, as previously stated, I will be voting No on this RFC. > > Having read this thread, and the previous one from half a year ago, I > will do so too. In short, we shouldn't be encouraging static classes as > a bag of static functions, that ought to be just namespaced functions. > > cheers, > Derick > --00000000000064c5f3061bcedbe2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
In JavaScript/Typescript, we can declare functions th= at are local to the current file by not exporting them. In C/C++ this is ac= hieved by simply writing the function in the implementation file as opposed= to the header. However, achieving a similar level of privacy in PHP requir= es using private static methods, or else you incur the overhead of creating= an object for stateless functions. How do you propose handling such cases = using namespaced functions? Can you think of any scenarios where hiding non= -API functions might be necessary? I'm curious why you keep returning t= o namespaced functions when they don't fulfill the same role.

Cheers,
Lanre
On Tue, Jun 25, 2024 at 9:20=E2=80=AFAM = Derick Rethans <derick@php.net>= wrote:
On Sun, = 23 Jun 2024, Larry Garfield wrote:

> On Sun, Jun 23, 2024, at 6:10 PM, Bilge wrote:
> > Hi Internals!
> >
> > I am pleased to present my first RFC: Static class
> > <https://wiki.php.net/rfc/static_class>. > >
> > This work is based on the previous discussion thread on this list= of the
> > same name, and hopefully captured all the relevant details,
> > notwithstanding anything unanticipated that may present itself du= ring
> > the implementation. Let me know if you feel anything important ha= s been
> > missed. I am aware it omits to mention specifics about messages s= o
> > emitted when runtime or compile-time errors occur, but I anticipa= te this
> > can be hashed out in the PR, unless consensus indicates otherwise= .
> >
> > I am aware this idea is not supported by everyone, but there seem= ed to
> > be enough positive voices for it to be worth a shot. I'd like= to get a
> > better idea of where people might stand when it comes down to a v= ote,
> > now there is a formal RFC, so we know whether it's worth comp= leting the
> > implementation, although any sentiments so proffered are of cours= e not a
> > commitment to vote any particular way and nobody should feel comp= elled
> > to speak to that unless comfortable. Looking forward to feedback!=

<snip>
>
> For the record, as previously stated, I will be voting No on this RFC.=

Having read this thread, and the previous one from half a year ago, I
will do so too. In short, we shouldn't be encouraging static classes as=
a bag of static functions, that ought to be just namespaced functions.

cheers,
Derick
--00000000000064c5f3061bcedbe2--