Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125455 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 2DC971A00BD for ; Fri, 6 Sep 2024 18:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1725648228; bh=TNzaNGETNFXQUSVErT5tbloajCrWXu2ue9H32bB4mdw=; h=Date:From:To:Subject:From; b=EdJ3CcQ421PH+hYr4Db0mmyB92KOa8/luBcPs7SVN86h2p7aJZAehH+9jjPdgGMKf JQmJg2ZNpC2Fa6QFoK794nXD0rFwWIVtweExefCxbaSAQvAyq2a6JX6f5ciASRGC4s nyuRAtE4tCl+HA5fUlN3nbkYYRI6fC+djJp3NdpM8RApJYN24dnUlduQUeILkwjA2p TCIgf/y1SSH2foYRATgv1yAuai+sSipEqGaI53GWt5YzJ5RZk+BbzRnVfGn/H7pO9n UCWc9d21b16M/FpGwb2bNDXfQzIyLDgdWJxLpvUKmCCwLZ59ts+3cvqvvlM8WgWUWK Wvci8is/xeyGg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B15A81805F3 for ; Fri, 6 Sep 2024 18:43:47 +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 autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout6-smtp.messagingengine.com (fout6-smtp.messagingengine.com [103.168.172.149]) (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 ; Fri, 6 Sep 2024 18:43:47 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id A1D9F1380187 for ; Fri, 6 Sep 2024 14:41:47 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-01.internal (MEProxy); Fri, 06 Sep 2024 14:41:47 -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 :message-id:mime-version:reply-to:subject:subject:to:to; s=fm2; t=1725648107; x=1725734507; bh=HBajY2lOiNo2FJKTSi4/4xmqcB+fwmWi UhUsrPJ6J7Q=; b=IOnjX5Mp/8aFSSrf24/zKqZdNFD9qHBRXgSM8pHdIHJdQgkH MR7s26vU4yJImmHRXKQZHiK2KcDFDJpupLGsPRnxXBbmFGzOhGjfqmSdaPLhLNlL GjHJp0tVOtAsVZIg/JPYSObBUxDfAxmRd2RxTF4Yx9JYYg8TU33omWNca2296euR 3Wb+syq7VFXDEh2olG/yM8CyGfYANq3qZlQz0QKO4ixi5lAK4HbVXTiO5HBCtkIN leSv/L7eCNL6w092cdCy+x+ZuiPaBOyfhYoJv4d6Q9simCiFby0pW5SjTw6Du+oL 028L9gaxpx5iZH9eCMe/SKKfbsRiplViTc9HWw== 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:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1725648107; x=1725734507; bh=HBajY2lOiNo2FJKTSi4/4xmqcB+fwmWiUhU srPJ6J7Q=; b=VFJs1dfhc4hroGzQBlUy2PaoCoOmG/BRuFyyufRT4LksilDXz2a f1KaYTJbGge5f1bFfyzHEZRo4JNy1b9D5cSGOPYRJiWWdoeZ2S5uO8WIUxh41kJj va5pgXRKuZEnqtFF9SSUWQu4M49jXgR+8WN1rHFMRoPZBiyhNi17SmKQIH0miC3I If8YJ3kBvTxhUWgoLsaLowbLZP98l9VVgz3rMY0TOUkPN3G7LmiGTPlaAgobGX5k yHcP9dgXUAJub4HZbcd6ylmUhT5/Qx74QLF1j/lxZnBWSrwwIMS2Xugp1ijmnfFh UMxGZ6X07pWibsGTGr3HyKFLDlkyoChWj+A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudeiuddgudeftdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepofggff fhvffkufgtsegrtderreertdejnecuhfhrohhmpedftfhosgcunfgrnhguvghrshdfuceo rhhosgessghothhtlhgvugdrtghouggvsheqnecuggftrfgrthhtvghrnhepveegkeejfe etudejtdfgudfhtdeiieehhedvgeeiieduffejgfevvdelffejgeffnecuffhomhgrihhn pehphhhprdhnvghtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomheprhhosgessghothhtlhgvugdrtghouggvshdpnhgspghrtghpthhtohepuddp mhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtsh drphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 4F91E780067; Fri, 6 Sep 2024 14:41:47 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Fri, 06 Sep 2024 20:41:23 +0200 To: internals@lists.php.net Message-ID: <0fa39535-f22d-4eba-b4df-90abe39e683a@app.fastmail.com> Subject: [PHP-DEV] bikeshed: Typed Aliases Content-Type: multipart/alternative; boundary=e8e9666370d34101b30c9f75992c2572 From: rob@bottled.codes ("Rob Landers") --e8e9666370d34101b30c9f75992c2572 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello Internals, I'm going to try something new. I've been working on another RFC called = "Typed Aliases" (https://wiki.php.net/rfc/typed-aliases). It is very muc= h a draft and in-flux, and I've already worked out the technical mechani= cs of it ... however, I am very unhappy with the syntax, and while I hav= e a few ideas about that; I assume this list will be much better at it t= han me. So, please bring your brushes and paint; I brought a bikeshed. If you haven't read it already, here's the TL;DR: - This RFC expands the "use ... as ..." syntax to allow any type express= ion on the left side. These aliases are PER FILE and expire once the fil= e is compiled. - This RFC also adds the ability for an alias to survive a file (current= ly using the "as alias" syntax that I don't like) which actually just cr= eates a special kind of class. When this special class is encountered du= ring type-checking, the alias is expanded and checked. It also allows th= is via a "type_alias()" function instead of the "use ... as alias ..." s= yntax. How it works: use string as alias MyString gets virtually compiled into a special class that would look something l= ike this to ReflectionClass (as it is currently): class MyString extends PrimitiveAlias {=20 const PrimitiveType aliasOf =3D PrimitiveType::string; } - Reflection is a bit weird here, and I'm not exactly happy with it; but= I'm curious what the list thinks. I'm open to virtually anything that m= akes sense here; including not allowing ReflectionClass on the type alia= ses at all. - Since these are "technically" classes, I went with just "use"-ing them= like normal classes. Originally, I had something different: "use alias = ..." (like "use function ...") to make it more clear. I will probably go= back to this, but I'm curious what others think. I'm going to take a step back and listen/answer questions. But please, g= rab a brush and paint. =E2=80=94 Rob --e8e9666370d34101b30c9f75992c2572 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hello Internals= ,

I'm going to try something new. I've been= working on another RFC called "Typed Aliases" (https://wiki.php.net/rfc/typed-aliases). = It is very much a draft and in-flux, and I've already worked out the tec= hnical mechanics of it ... however, I am very unhappy with the syntax, a= nd while I have a few ideas about that; I assume this list will be much = better at it than me. So, please bring your brushes and paint; I brought= a bikeshed.

If you haven't read it already= , here's the TL;DR:

- This RFC expands the = "use ... as ..." syntax to allow any type expression on the left side. T= hese aliases are PER FILE and expire once the file is compiled.

- This RFC also adds the ability for an alias to su= rvive a file (currently using the "as alias" syntax that I don't like) w= hich actually just creates a special kind of class. When this special cl= ass is encountered during type-checking, the alias is expanded and check= ed. It also allows this via a "type_alias()" function instead of the "us= e ... as alias ..." syntax.

How it works:

use string as alias MyString

<= /div>
gets virtually compiled into a special class that would look = something like this to ReflectionClass (as it is currently):

class MyString extends PrimitiveAlias {
  const PrimitiveType aliasOf =3D PrimitiveType::string;
=
}

- Reflection is a bit weird here, and I'= m not exactly happy with it; but I'm curious what the list thinks. I'm o= pen to virtually anything that makes sense here; including not allowing = ReflectionClass on the type aliases at all.

- Since these are "technically" classes, I went with just "use"-ing the= m like normal classes. Originally, I had something different: "use alias= ..." (like "use function ...") to make it more clear. I will probably g= o back to this, but I'm curious what others think.

I'm going to take a step back and listen/answer questions. But p= lease, grab a brush and paint.

=E2=80=94 Rob
--e8e9666370d34101b30c9f75992c2572--