Re: Readonly properties and interfaces

From: Date: Thu, 08 Jul 2021 08:01:48 +0000
Subject: Re: Readonly properties and interfaces
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-115363@lists.php.net to get a copy of this message
Le 07/07/2021 à 23:16, Larry Garfield a écrit :
The property accessor RFC (which didn't get to a vote) discussed this, and specifically proposed making properties part of the interface for... basically all the reasons given here. My preference would be to add property accessors in 8.2 (at least the asymmetric visibility part), and then redefine readonly properties as a shorthand for a "get only" implicit accessor property; which, if I recall correctly, is essentially the same semantics as readonly. (I didn't check the RFC; I'm going by memory here.) That would include interface properties by nature. --Larry Garfield
Using property accessors on interfaces is fine too, but the one thing that properties directly being defined on interfaces do bring is that you don't have to repeat implementation of those in your implementations. That's a detail, but a practical one. Regards, -- Pierre

« previous php.internals (#115363) next »