Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126891 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 7922E1ADF50 for ; Fri, 21 Mar 2025 11:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742555736; bh=D2ukNbY0u8mUZXLJwfq3dhjFAbA8N40+2ZdVTAUpxJM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XMg7ITS8vL5WKH4tNI8mzMKU9X+zZG2K7f5ujLwJAahbINWedQYQAg/QWAnv3Ay35 Blp5ezLahMeVlO/8RLJe4fnVXzkNB+yP7EeAeuKnge0Nv9lYSS0ytKtucwtn1hdJHl UB662yNLrc4ynrJsDrP5FcgqRBEK6xFvZy9DHP7zGBF6wkRKr5ZQCSfy91R7AkpsvC N2Bf5+1r/fZ0iMjgauM4a6YhgPaIv3OZT2WrwDvygrTyxNubW1PnzKGfPQibvosKpY Z17WigL18UEw0YgOuJni2akPpReAX4lLTlxeaoUAWi7GR1qftQAJnsPUbD7Ts4ACZ/ FqPDnktuscfwg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 30332180574 for ; Fri, 21 Mar 2025 11:15:34 +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=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_PDS_PRO_TLD autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from bisque.elm.relay.mailchannels.net (bisque.elm.relay.mailchannels.net [23.83.212.18]) (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, 21 Mar 2025 11:15:30 +0000 (UTC) X-Sender-Id: yszpovajlk|x-authuser|juris@glaive.pro Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D69CA8A571A; Fri, 21 Mar 2025 11:17:59 +0000 (UTC) Received: from server42.areait.lv (100-125-202-196.trex-nlb.outbound.svc.cluster.local [100.125.202.196]) (Authenticated sender: yszpovajlk) by relay.mailchannels.net (Postfix) with ESMTPA id D0BB58A51BC; Fri, 21 Mar 2025 11:17:58 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1742555879; a=rsa-sha256; cv=none; b=vcab+B6jCH38oZ2fmIfSp3O26yehvxtspR8vl6LusK5jMbpBZzNp7GJ9u6Hso50Egsw0KF xfTtNmGgT7yYl77m4y3gpdSewUeh3rKTi8Il38EOV66zIdiz1Xulrjz2/fotBey8Smth1s cMkc4xkREjnwa+OHhBBCA3TBztc7mhTHKLufyvFnf6QMeEQxPgbrL+T0wwQ5PDQHSY/bLk mDuI68H3FKooET/5VOjwhdFR9BvaRozypCBCYjKSnxBMDxHrBlYi5d3WeEchtIlg/diN+X JM8eWrgPSq0iqtsSLdY5li6BwVMtvHIKnc5RVDemN1iZnuJkhF1Ago0eG11K8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1742555879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0EH4CATuk3NdPBIMds2TF7QSY8F8A5JBZnDV8vAxMJ4=; b=AHG4F5NYw1NcVkY1c0raaMiwe8GoG+xaoI7IpNtQJSPo2pTo/BQomC9qXqIFMfvBjMC04X 0Gz2JHdBd12yG+jPlgyIYJywuTa6hVbQoj5QQqU6/EU5dlbxpOCcfpHMpDFIAW86Es53Oy SLHn9/hj437UtV+Lkq+Ha6raDSVFK/o7qXxHHPGoG7cNSRMCgpAXOnbEbSniwd4sSwMLik Dbhf/Q89uWbXIt/B/HouM4eyL7GKMwD2jopOSAKoJA/sPVlDZM3X6R6a0xDOrjPwxY7RqR NY9FY3FzcCdOLnZ55JKpquB6PIJJ8oyABuVwsFzJqBI9C9LC/FzwzS73L44crA== ARC-Authentication-Results: i=1; rspamd-67d8974966-8v6bq; auth=pass smtp.auth=yszpovajlk smtp.mailfrom=juris@glaive.pro X-Sender-Id: yszpovajlk|x-authuser|juris@glaive.pro X-MC-Relay: Neutral X-MailChannels-SenderId: yszpovajlk|x-authuser|juris@glaive.pro X-MailChannels-Auth-Id: yszpovajlk X-Vacuous-Tangy: 0edf27762cf74e91_1742555879523_3707045316 X-MC-Loop-Signature: 1742555879523:2873644879 X-MC-Ingress-Time: 1742555879523 Received: from server42.areait.lv (server42.areait.lv [212.7.207.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.125.202.196 (trex/7.0.2); Fri, 21 Mar 2025 11:17:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=glaive.pro; s=default; h=Content-Type:Message-ID:References:In-Reply-To:Subject:Cc:To: From:Date:MIME-Version:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=0EH4CATuk3NdPBIMds2TF7QSY8F8A5JBZnDV8vAxMJ4=; b=Mv8+8gWah0an8dnoAl75aSvHxv fllU/WY8CezJ8AjO+e6WmSRB+Me8GwulG1LS+tcXTwmP4Vp0zHhAMPNwvxIwejiCM0A0/Q6kYlWdr zbKW1z0S7oLrB+NgrIq8bsgSgDlQPccn7i7UG6+4N5mXQaKx2snMJa0HdFfYna84CzFMmG6yAL5KL ANYoVvwD0SmEY0G1Ml/BeXou/f7v96Pm/BVvtCYFJ5brpkxqCHmjoET+GYBIlXoVNDBsPGkAwbAXP rDEDEbFcUD7TRi+Z773eLpB9muXi1Q4N0u3NF3YALCLYgS0P+xCEEYz7dKfXUKQrrzC2wgk3gT3Pk a2oEFzrQ==; Received: from [::1] (port=36256 helo=glaive.pro) by server42.areait.lv with esmtpa (Exim 4.96.2) (envelope-from ) id 1tvaNw-009UrG-0K; Fri, 21 Mar 2025 13:17:56 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Fri, 21 Mar 2025 13:17:55 +0200 To: "Gina P. Banyard" Cc: 'php internals' Subject: Re: [PHP-DEV] [VOTE] Optional Interfaces In-Reply-To: References: <084101db94b8$73da47e0$5b8ed7a0$@glaive.pro> User-Agent: Roundcube Webmail/1.4.8 Message-ID: <5aa023086288aeee362bd7720e933368@glaive.pro> X-Sender: juris@glaive.pro Organization: SIA "Glaive.pro" Content-Type: multipart/alternative; boundary="=_43b2c40e3d2a043f8c6c09d05914fbd2" X-AuthUser: juris@glaive.pro From: juris@glaive.pro (Juris Evertovskis) --=_43b2c40e3d2a043f8c6c09d05914fbd2 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 2025-03-20 18:09, Gina P. Banyard wrote: > And another user [2] was basically suggesting my previous solution of > adding support for type classes/runtime implementation of interfaces. Hey, There are two ideas -- the `$object implements Iface` that you suggested and the `SomeClass implements Iface` that was suggested on reddit. I see the instance-specific one as something that a consumer can do in their project if they know that the `$object` actually fits where needed. That would be a cool feature per se. But it seems to me it would take a lot of bridging code to provide such "dynamically implementing" objects if you're the package author. I'll address the `SomeClass implements Iface` expression vs `class SomeClass implements ?Iface` hereinafter. The `?OptionalInterface` would always be within the class definition and in a real-life project with PSR-4 you could check the interface existence by inspecting the file tree or click-throughing the name in an IDE. It's not obvious to me how the runtime implementation expressions could be in such a discoverable spot. The expression could be anywhere in the project. And it will likely be inside conditionals. It would surely be hard to discover manually. I'm not a developer of stan tooling, but I expect it would complicate automated static analysis as well. BR, Juris --=_43b2c40e3d2a043f8c6c09d05914fbd2 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8

On 2025-03-20 18:09, Gina P. Banyard wrote:

 
And another user [2] was basically suggesting my previous = solution of adding support for type classes/runtime implementation of inter= faces.
 

Hey,

There are two ideas — the `$object implements Iface` that you sugg= ested and the `SomeClass implements Iface` that was suggested on reddit. I = see the instance-specific one as something that a consumer can do in their = project if they know that the `$object` actually fits where needed. That wo= uld be a cool feature per se. But it seems to me it would take a lot of bri= dging code to provide such "dynamically implementing" objects if you're the= package author.

I'll address the `SomeClass implements Iface` expression vs `class SomeC= lass implements ?Iface` hereinafter.

The `?OptionalInterface` would always be within the class definition and= in a real-life project with PSR-4 you could check the interface existence = by inspecting the file tree or click-throughing the name in an IDE.

It's not obvious to me how the runtime implementation expressions could = be in such a discoverable spot. The expression could be anywhere in the pro= ject. And it will likely be inside conditionals. It would surely be ha= rd to discover manually. I'm not a developer of stan tooling, but I expect = it would complicate automated static analysis as well.

BR,
Juris

--=_43b2c40e3d2a043f8c6c09d05914fbd2--