Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129144 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 lists.php.net (Postfix) with ESMTPS id 6B5F51A00BC for ; Fri, 7 Nov 2025 22:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1762556324; bh=EWcAaZVZljLPFo2/ha5qtwwkbkQgG9m6D5pE5wFmNsg=; h=Date:From:To:Subject:In-Reply-To:References:From; b=PuuB4Jk3D7PXGz9xnnbI9ACytqQb88jikCXtJKVrc0bJvHLtN0VOkF2XIfihoW6Vn uR7+avlMqyBu7CQhywdLRGvNmkWJwjebJNrVC8LJ32CsYsteKFaJrx0A3lWprv1ZbW mdr/+TYTW0ObPJD+iic/g5zPRSMSbvis+FzslS2v+Cec40VBAkD2hNkzf1ZtRHw2nW T2ntIoXJj3lkH1a0PbgZZjiXrFqhhUhIdjdYAd0hm9HucRVAne03em3vk7S7fzNjq0 9iuXcO0Oipc36aMJxlINMwk/8vJsWfrt3aHcWXfKUI0adsEljIlycRrYZOB/XU4Cau EoYZ+8dyQSj5Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4328B180079 for ; Fri, 7 Nov 2025 22:58:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-a6-smtp.messagingengine.com (fout-a6-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, 7 Nov 2025 22:58:43 +0000 (UTC) Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 6A0AFEC0475 for ; Fri, 7 Nov 2025 17:58:38 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Fri, 07 Nov 2025 17:58:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding: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=fm3; t=1762556318; x=1762642718; bh=r6PTBbjWZ3UOa857wci1BTApSHtcQLsDyN5QrLr8i3I=; b= ql08eSh6cd/4LKNa6QB1XuySeQATg4LM5P44kzWdFt50mFyQFgxNMthL8YCdw51H UUnxq4t2/4rlFVKMg5kgMPAAag858BW18r6pH1eSd43aRjpKXmpGwlWj2YZe5cvg HtxUEUrsR7r5mDHIoXZPQMFKqwjKx9VHygEpgkHZdI/oc1kvnzojzSFTVP6DAfqA gXiO8du+XGtvfpz/vBPG/EqmeMjptAImxV8NF345p2PHvpEAIP4a1lVcyDZPda14 oim4gRr4UWqh/iLX7hXw2h4s+wZoqsbrxH3RplYpa+5P+syNmCNe1QKwj9JHwAax EVyEuxEglKXttrMejX1uiQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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-sender :x-me-sender:x-sasl-enc; s=fm3; t=1762556318; x=1762642718; bh=r 6PTBbjWZ3UOa857wci1BTApSHtcQLsDyN5QrLr8i3I=; b=yA5aHjt/SaTmmOY+8 5NQK0gapFErkQc2G6s6mKtiaiMgrC4Du6HUBs7NxWbIPajsR28dSqDcjv/bG3ieb dKRfVFYszTXbhk2+HgLGizEgEfqPUPvQxjO91opNRYVeM7swE6Q73a61+cWbomY4 3o3Kos9MTZoOH3QPOATyts1t4uCEflS6e720qFwjLkEyPYg8zcS5wqg+JQMx83Bn vHXlFKSYKsRiR5UogOCwPLQwocceVOtF4ZacMmlOx33HWX1HFHS3/D+68w/aF43h wH7a+SRkSYmb6ceoqh4V8763+GwHUE/feXzB3Qx+xUME9QQrD1v2hTt1qwUNSJkb cHTUQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduledtledvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvffufggjfhfkgggtgfesthhqmhdttderjeenucfhrhhomhepfdftohifrghn ucfvohhmmhhinhhsucglkffoufhorfgnfdcuoehimhhsohhprdhphhhpsehrfigvtgdrtg hordhukheqnecuggftrfgrthhtvghrnhepheelffetiefgveduteefudegtdduveeludeg ueegleehiefhhefgtdekveevgfelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepihhmshhophdrphhhphesrhifvggtrdgtohdruhhkpdhnsggp rhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnh grlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 7 Nov 2025 17:58:37 -0500 (EST) Date: Fri, 07 Nov 2025 22:58:34 +0000 To: php internals Subject: =?US-ASCII?Q?Re=3A_=5BPHP-DEV=5D_Pre-RFC_proposal=3A_opt-in_?= =?US-ASCII?Q?implicit_interfaces_/_structural_typing?= User-Agent: K-9 Mail for Android In-Reply-To: <80487519-71ed-47d6-b499-a89636e1c18f@app.fastmail.com> References: <1fe53b85-5315-4dbb-94a1-9a514cb82ed6@rwec.co.uk> <80487519-71ed-47d6-b499-a89636e1c18f@app.fastmail.com> Message-ID: <1BC09983-CC20-4CCC-BAFE-4253FC360A8D@rwec.co.uk> Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 7 November 2025 21:34:56 GMT, Larry Garfield = wrote: >__toString() is *old*=2E It may go all the way back to 5=2E0, but it was= there at least as of 5=2E2=2E The problem is that there was no way to typ= e against it=2E=20 I know all that=2E I've just never understood why you would *want* to type= against it=2E The only thing you can do with that knowledge is turn the o= bject into a string, so why not just ask for a string in the first place? But I apologise for drifting off topic; the relevant point is that it work= s exactly how the proposed implicit interfaces would, so whatever reasoning= was used for it might serve a useful example for other potential uses=2E I= f nothing else, being able to say "it's a built-in implicit interface" woul= d be less confusing than explaining it as a magical special case=2E Who knows, maybe there are people wishing they could type against other ma= gic methods, who could do so by declaring their own implicit interfaces=2E As I say, I'm personally much more interested in highly explicit code, so = am more likely to go completely the opposite direction: use an *empty inter= face*, where the only thing you're doing is "tagging" a class as intended f= or a particular purpose=2E But, I know there are people who like "duck typing", and implicit interfac= es or structural typing give a way to formalise that, so I can see value fo= r those people=2E Rowan Tommins [IMSoP]