Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129145 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 3CBDC1A00BC for ; Sat, 8 Nov 2025 05:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1762580736; bh=LY9aT5fUrFLVYkI98xCNq8TDoTFKtyhCnHqGSNGfiT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DxPp0AAKecwnlnQf9NiCRJhGEoaBJjlfXuWtbwI9rPpwEPFgAAm3WKjr/SHwFSpXM Tx736dZvWJIpvjZKFudKgpo2IrXO9BJU+AV8SuNsymlHlyMDFiCW8C9RNTOSVKmRAn yPPsWBUknaOKDT3cjT/Fd+vIkYWGScuO433WwNvcId9uCqZuh8MJ+b1CJtp1kuYVKf YlEHJQ+wqXcba1aL0ucn9yeIjAqXFtSXy0843DxNcx3HUJSrMfHmo4wN7FEoIQlkAk oLuAH5EmQJ8fNnpqxQen2kT9imqLmCDec7sImW5yQp6L8XWIeXE/2Wo2h+n3RhiODH aglBVI+abMkvQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 94F7418006D for ; Sat, 8 Nov 2025 05:45:35 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from sonic301-20.consmr.mail.ir2.yahoo.com (sonic301-20.consmr.mail.ir2.yahoo.com [77.238.176.97]) (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 ; Sat, 8 Nov 2025 05:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1762580727; bh=sz33fUng+YFYTX7gbfZdof2pvaNAbfp1odmaxRbQ56k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=itz0X0N/hq/wJSyHiTrrxavK1TdXmfPFjor1GXR89CbUx5E5aZTS8At3RGWJyT3dqEn1a5QGaqvxeueKAJzgenjOJFhwPM+TtQE9Qw37SIkhCqGUgU36f3PD/sDUL0k5G15aF0o4kNRmhcra+foSevdLBjiYG/CU9bh77ZMvbShX8MQYeb5Ht+qJDN0y8HFN3QZ6YdeC5WfugMJRghWmnsmbit7su32xRYqwPrv6evSFXMYmokfy8C44JX/1twYciDX1XHAVg1PZhD6pLUuoGXMaLRsbTVsWMtzsqyjxW4RgHMhU6bBgRrMv3rs8mCC1hW60qftSZVlqoRD104fsBA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1762580727; bh=BBI3sE92OaCgG2Qghgp3tD+pcughnLtaLnlHy6irwoJ=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=XaexGWWATPHKmWSRn19Q6/x3l8uBqbCnbYQG3gTy93BwYN+Ie61bx0o2cVLa7EdHW66CeihY6Cp5xq8OKPKBRtqpsj/AI5zYYWePxf3WGckyL9EZtKI6qGjDqAbhmoanRExzxfbW4vBALm4WViUkq2coQql4wFBSMwA+F3b7qyJy8drNaXuDWbTn6QF7hvKF0EvCI9O2Ppiahme/eyqsc0jPXM0fgwBu/aENdWaGR+GGa8uTMBuoeMbv2FK25kXjTpWOU3hMID9cUIggurK/KSrikq/fYkfJcifyJfUmB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diyjY0Q6HJpNYoiY6uz0cuozsqzMWeWh.jQTcrmW4K26ygLxh D1bzxrI2jNUBLLqI1rf7FWXJRLEWYq.jJA3HQuHIVED76Sum338iWoCSHe9XtrZDO0YicV4O_H2E wtWEnefsAjP0jA.LX5DdmFThag0YqyraHIHzdw24IAgSeUsB81SdwbuNLZ1i3ZkDViahCfeYisJs gV4OCHd9LbycopJF6NyXCc0_ULfcuMUC.PK6KHxKXFRHADNwMPBX9yYffNdETpE0- X-Sonic-MF: X-Sonic-ID: 81be960e-2ee4-4a8b-860f-ebfe234cc422 Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ir2.yahoo.com with HTTP; Sat, 8 Nov 2025 05:45:27 +0000 Received: by hermes--production-ir2-5fcfdd8d7f-6jxxc (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID f56c078856fd164f5dbc6a61ca800c78; Sat, 08 Nov 2025 05:45:26 +0000 (UTC) Content-Type: text/plain; charset=utf-8; format=flowed Message-ID: <1762580654610.2419643189.4145879058@yahoo.de> To: malone.spencer@gmail.com Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Pre-RFC proposal: opt-in implicit interfaces / structural typing Date: Sat, 08 Nov 2025 05:45:25 +0000 In-Reply-To: References: X-Mailer: Vivaldi Mail User-Agent: Vivaldi Mail/7.6.3797.63 Content-Transfer-Encoding: 7bit Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 From: hanskrentel@yahoo.de (Hans Krentel) On Friday 07 November 2025 18:05:03 (+01:00), Spencer Malone wrote: > Hey all! Long time browser, first time emailer. I wanted to start a pre-RFC > discussion on the proposal of opt-in implicit interfaces / structural > typing / "golang style interfaces". > > I have an early mostly working POC at > https://github.com/php/php-src/compare/master...SpencerMalone:php-src:implicit, > and was curious if this was an idea that could get any traction as an RFC? > > For those who don't want to open the link, it's essentially: > > ``` > implicit interface Drawable { > public function draw(): void; > } If you may be that kind and allow an implicit interface to use a trait... > > class Circle { > public function draw(): void { > } > } > ... then the class could use a trait as well which is then closing the distance to traits that are not able to full-fill interfaces and their using classes, so the classes can borrow from the traits and both then somewhat profit from implicit interfaces. The "innerface" naturally could only use the non-body parts (abstract parts) of the trait methods / properties, so the copy direction towards the interface is a reduction to the interface the trait implies. The trait then can be used in the implicit interface definition to do both at once (defining an interface and providing an implementation). > > assert((new Circle()) instanceof Drawable); // This would be true > ``` > and if I may add, truly great - regardless with or without such trait reuse. if it then could work en-par with function defintions (define after use which currently "explicit" interfaces are not capable of) this would make it a perfect and modern addition to the language in my very own eyes. > There is some previous art around here in the form of... > [...] > > - Spencer > - h.k.