Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:123615
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 D15DE1A009C
	for <internals@lists.php.net>; Sat, 15 Jun 2024 14:53:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1718463290; bh=sWtkYTzcRoVENsrd0pLOHpXA1TyhkCyJc5eRfcsVwUA=;
	h=In-Reply-To:References:Date:From:To:Subject:From;
	b=Icv8cRvHkqCLGGNB4yycJsQuSS3f49PSoKXEtkpkmMSfWktaXXNPuobzvFqkwG2o0
	 664ZnmflguGViANWfsp6thtjRaQDSDZYl8TRsGFcDvC13FhqWUjLe4PjKYFWk2xDqC
	 2aSdgcvZ4gLIRbUevUVNLphuBqjx8cB5bjVqvUSdV1h30hDiqOXQ17f5VvnmaKWvZz
	 6DmK/W6Ln8rmYhJsQS2y1yqZ+zp7/nB5NnqVpcdcIJDTlyLs1xQ++iCn+r5bOtBpTi
	 u8EMmY+c/SkORIvqtZZxvM7l/nJPZhq7SH4xW5p7kMd16BmTcgx+baYrgDbolQgd66
	 9dKbQ4cY04d7w==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id B060C180041
	for <internals@lists.php.net>; Sat, 15 Jun 2024 14:54: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_MISSING,HTML_MESSAGE,
	RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,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: <rob@bottled.codes>
Received: from fhigh3-smtp.messagingengine.com (fhigh3-smtp.messagingengine.com [103.168.172.154])
	(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 <internals@lists.php.net>; Sat, 15 Jun 2024 14:54:48 +0000 (UTC)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
	by mailfhigh.nyi.internal (Postfix) with ESMTP id 01951114010A
	for <internals@lists.php.net>; Sat, 15 Jun 2024 10:53:37 -0400 (EDT)
Received: from imap49 ([10.202.2.99])
  by compute1.internal (MEProxy); Sat, 15 Jun 2024 10:53:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes;
	 h=cc:content-type:content-type:date:date:from:from:in-reply-to
	:in-reply-to:message-id:mime-version:references:reply-to:subject
	:subject:to:to; s=fm2; t=1718463216; x=1718549616; bh=sWtkYTzcRo
	VENsrd0pLOHpXA1TyhkCyJc5eRfcsVwUA=; b=wGrK9B8etk+dk1elV1fO6pAXaE
	vOdFbxpomctpH+p3uvDxRLWuMjDqK1l7PgD7Z201l6AGzGarAjALGlTioeXrmXWD
	x24wo/m6H1YhsiJO3We83bhugb54c+AvsUpU0pvAIKFG6ZGkcRRuNU3dUzBwRmHU
	X7Mney0g5sBlFVL8YUSDnNjM/d24XeLeAHfMm7zKcG/IcxndGF7dC4gMJxZd5fx4
	ns7apfUiwaEp2Y40UIy8lbtkMs808LAPYv6xB1qY8Z1JoO/5JfFS262zn7HUw7nx
	L//yx4aJPVlBV9KeWjPSbuDxa/rgqIWIAOzDMdcIGyJlhFoLOM+DByk778Pg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
	messagingengine.com; h=cc:content-type:content-type:date:date
	:feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
	:message-id:mime-version:references:reply-to:subject:subject:to
	:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=
	fm1; t=1718463216; x=1718549616; bh=sWtkYTzcRoVENsrd0pLOHpXA1Tyh
	kCyJc5eRfcsVwUA=; b=dWB1EhUBsIZIAjPfde61veiuSSNceNgmux08tw5tY7Nv
	sqCr0iR9zqy4q/o1dLPRYo/Ob4PQZUR98dx+Cep9k43sAubioR5IAwpHtygIOf9W
	6qlZWVSyBpxI3FYItTQmMQAZODuaCei12iK+55M/Xqz2FWHUKo4e7Rov5y4DnykQ
	Dvda1+0AAqqTt6l78GRaJYUSQUeHfdA+1Jg0EsRqznZIB3iu1e6tJFVlxeuHIgrI
	qTnD07gxWwkNXA/VhpAWmLdYbCxZ8ud+un4hEucRtVsT1M5qBu/zcsVZt+ZovdUL
	mj/KVnkBY7R35h0o6yWTw+FkjeBEzR0hrZbMF/WbTA==
X-ME-Sender: <xms:8KptZrUfD16TbM0LVGkGpv3ySNLMCCFLONegLntzE1hkO3fwPpPLRw>
    <xme:8KptZjk6vxsxr6LJDHC-iK3ZFbl67_mBvL4Lpyp03kogpRTNLX0PhvCSbbzYofv24
    F4FmjWXuVVd3gopM_s>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedvuddgkedvucetufdoteggodetrfdotf
    fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
    uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsegrtd
    erreerreejnecuhfhrohhmpedftfhosgcunfgrnhguvghrshdfuceorhhosgessghothht
    lhgvugdrtghouggvsheqnecuggftrfgrthhtvghrnhepiefggeffkeeggfdvudfhheevhe
    fhgffgvedthfehteehleetheejheekleejjedtnecuffhomhgrihhnpehphhhprdhnvght
    pdgvgihtvghrnhgrlhhsrdhiohenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh
    epmhgrihhlfhhrohhmpehrohgssegsohhtthhlvggurdgtohguvghs
X-ME-Proxy: <xmx:8KptZnZYp7Bj-yhaseecgLk7b3fT-ifZR9ceZ6px6tWFeAoIRcrOVg>
    <xmx:8KptZmUaZrY5_wFjgRP9L4hDwvclrUNPKZ4hGEch-EfXRV9-gGZ6iA>
    <xmx:8KptZlm_j4zN34AhN1COfvGcxDaBc6ry0SHgAjvLzisrLdEFTetxgA>
    <xmx:8KptZjcLERT_lWr8L9_HtrLTipYu-9P02t7YS_j25rZXM-fBSjl8Ww>
    <xmx:8KptZkvO3vAbo1LzQT2QMX4teHMWcPts9GLYt3hewBS0jPG341n--uWC>
Feedback-ID: ifab94697:Fastmail
Received: by mailuser.nyi.internal (Postfix, from userid 501)
	id 857CB15A0092; Sat, 15 Jun 2024 10:53:36 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
User-Agent: Cyrus-JMAP/3.11.0-alpha0-515-g87b2bad5a-fm-20240604.001-g87b2bad5
Precedence: bulk
list-help: <mailto:internals+help@lists.php.net
list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net>
list-post: <mailto:internals@lists.php.net>
List-Id: internals.lists.php.net
MIME-Version: 1.0
Message-ID: <fb9c81f0-6c18-4ba0-b564-d95dad324898@app.fastmail.com>
In-Reply-To: <1fc2f2d0-718f-45ec-8968-b66a1bde686e@scriptfusion.com>
References: <0cf69a14-f1b5-4077-9d91-d7b579485eec@scriptfusion.com>
 <936e1aa3-48cc-4552-9f68-676ebcdeb596@rwec.co.uk>
 <1fc2f2d0-718f-45ec-8968-b66a1bde686e@scriptfusion.com>
Date: Sat, 15 Jun 2024 16:52:36 +0200
To: internals@lists.php.net
Subject: Re: [PHP-DEV] Static class
Content-Type: multipart/alternative;
 boundary=72ef5869ea504674804165fc4ca2a15b
From: rob@bottled.codes ("Rob Landers")

--72ef5869ea504674804165fc4ca2a15b
Content-Type: text/plain;charset=utf-8
Content-Transfer-Encoding: quoted-printable



On Sat, Jun 15, 2024, at 16:40, Bilge wrote:
> On 15/06/2024 14:53, Rowan Tommins [IMSoP] wrote:
> > On 15/06/2024 12:16, Bilge wrote:
> >>
> >> I want to introduce the `static` keyword at the class declaration=20
> >> level. That is, the following would be valid: `static class Foo {}`=
.=20
> >
> >
> > This has been proposed before, and was rejected at vote. It was near=
ly=20
> > 10 years ago, so opinions may have changed, but it would be worth=20
> > reading through the prior discussion to anticipate or counter the=20
> > objections raised, and avoid re-treading the same ground.
> >
> > - RFC: https://wiki.php.net/rfc/abstract_final_class
> > - Pre-vote discussion threads: https://externals.io/message/79211 an=
d=20
> > https://externals.io/message/79338
> > - Final vote thread: https://externals.io/message/79601
> >
> > Searching my list archive, I find that it came up again a few months=20
> > ago, which I'd entirely forgotten: https://externals.io/message/1217=
17
> >
> > Slightly tangential, but some of the same discussion also came up on=20
> > these rather lengthy threads about "static class constructors":=20
> > https://externals.io/message/84602 and https://externals.io/message/=
85779
> >
> >
> > Regards,
> >
> Hi Rowan,
>=20
> That's all quite interesting, but I didn't get a good sense of why the=20
> idea was rejected, other than people didn't like "abstract final" as t=
he=20
> syntax (thank God). As for why "static" was rejected, as stated, I don=
't=20
> get a good sense of it at all, but rather than fall back on the opinio=
ns=20
> of many who are mostly absent among those polled nine years ago, I'd=20
> rather get a sense of the current sentiment of those present today.
>=20
> Cheers,
> Bilge
>=20

I can see these mostly being used for factories, laravel facades, or uti=
lity functions. I think they would probably be useful in some codebases.

I would argue that in the codebases I work in, these types of constructs=
 represent a code smell and it would be a lot easier to catch via static=
 analysis and prevent. The current trick of using traits is much harder =
to catch except during code review.

So, I say =E2=80=9Cyes please.=E2=80=9D

=E2=80=94 Rob
--72ef5869ea504674804165fc4ca2a15b
Content-Type: text/html;charset=utf-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html><html><head><title></title><style type=3D"text/css">p.Mso=
Normal,p.MsoNoSpacing{margin:0}</style></head><body><div><br></div><div>=
<br></div><div>On Sat, Jun 15, 2024, at 16:40, Bilge wrote:<br></div><bl=
ockquote type=3D"cite" id=3D"qt" style=3D""><div>On 15/06/2024 14:53, Ro=
wan Tommins [IMSoP] wrote:<br></div><div>&gt; On 15/06/2024 12:16, Bilge=
 wrote:<br></div><div>&gt;&gt;<br></div><div>&gt;&gt; I want to introduc=
e the `static` keyword at the class declaration&nbsp;<br></div><div>&gt;=
&gt; level. That is, the following would be valid: `static class Foo {}`=
.&nbsp;<br></div><div>&gt;<br></div><div>&gt;<br></div><div>&gt; This ha=
s been proposed before, and was rejected at vote. It was nearly&nbsp;<br=
></div><div>&gt; 10 years ago, so opinions may have changed, but it woul=
d be worth&nbsp;<br></div><div>&gt; reading through the prior discussion=
 to anticipate or counter the&nbsp;<br></div><div>&gt; objections raised=
, and avoid re-treading the same ground.<br></div><div>&gt;<br></div><di=
v>&gt; - RFC:&nbsp;<a href=3D"https://wiki.php.net/rfc/abstract_final_cl=
ass">https://wiki.php.net/rfc/abstract_final_class</a><br></div><div>&gt=
; - Pre-vote discussion threads:&nbsp;<a href=3D"https://externals.io/me=
ssage/79211">https://externals.io/message/79211</a> and&nbsp;<br></div><=
div>&gt;&nbsp;<a href=3D"https://externals.io/message/79338">https://ext=
ernals.io/message/79338</a><br></div><div>&gt; - Final vote thread:&nbsp=
;<a href=3D"https://externals.io/message/79601">https://externals.io/mes=
sage/79601</a><br></div><div>&gt;<br></div><div>&gt; Searching my list a=
rchive, I find that it came up again a few months&nbsp;<br></div><div>&g=
t; ago, which I'd entirely forgotten:&nbsp;<a href=3D"https://externals.=
io/message/121717">https://externals.io/message/121717</a><br></div><div=
>&gt;<br></div><div>&gt; Slightly tangential, but some of the same discu=
ssion also came up on&nbsp;<br></div><div>&gt; these rather lengthy thre=
ads about "static class constructors":&nbsp;<br></div><div>&gt;&nbsp;<a =
href=3D"https://externals.io/message/84602">https://externals.io/message=
/84602</a> and&nbsp;<a href=3D"https://externals.io/message/85779">https=
://externals.io/message/85779</a><br></div><div>&gt;<br></div><div>&gt;<=
br></div><div>&gt; Regards,<br></div><div>&gt;<br></div><div>Hi Rowan,<b=
r></div><div><br></div><div>That's all quite interesting, but I didn't g=
et a good sense of why the&nbsp;<br></div><div>idea was rejected, other =
than people didn't like "abstract final" as the&nbsp;<br></div><div>synt=
ax (thank God). As for why "static" was rejected, as stated, I don't&nbs=
p;<br></div><div>get a good sense of it at all, but rather than fall bac=
k on the opinions&nbsp;<br></div><div>of many who are mostly absent amon=
g those polled nine years ago, I'd&nbsp;<br></div><div>rather get a sens=
e of the current sentiment of those present today.<br></div><div><br></d=
iv><div>Cheers,<br></div><div>Bilge<br></div><div><br></div></blockquote=
><div><br></div><div>I can see these mostly being used for factories, la=
ravel facades, or utility functions. I think they would probably be usef=
ul in some codebases.<br></div><div><br></div><div>I would argue that in=
 the codebases I work in, these types of constructs represent a code sme=
ll and it would be a lot easier to catch via static analysis and prevent=
. The current trick of using traits is much harder to catch except durin=
g code review.<br></div><div><br></div><div>So, I say =E2=80=9Cyes pleas=
e.=E2=80=9D</div><div><br></div><div id=3D"sig121229152">=E2=80=94 Rob<b=
r></div></body></html>
--72ef5869ea504674804165fc4ca2a15b--