Re: [RFC] [DISCUSSION] Immutable/final/readonly properties

From: Date: Mon, 16 Mar 2020 09:47:16 +0000
Subject: Re: [RFC] [DISCUSSION] Immutable/final/readonly properties
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  Groups: php.internals 
Request: Send a blank email to internals+get-109051@lists.php.net to get a copy of this message
On Sun, 15 Mar 2020 at 21:41, Jakob Givoni <jakob@givoni.dk> wrote: > On Sun, Mar 15, 2020, at 8:48 AM, Marco Pivetta wrote: > > I think what will happen is that people will start requesting for > read-only > > properties with default values to be over-writable-once > > Exactly, I think that intuitively, developers will not see a default > value as an actual "write". > They will expect to be able to overwrite it once. > I'm sure different people will react differently, but my intuition is quite the opposite: I would probably call the inline assignment to the property an "initial value", not a "default value", and I would intuitively compare it to assigning it in the constructor. I would also understand the intent of "write once" to be "once initialized, can't be overwritten", so would personally have no expectation that I could initialize a variable in both the property definition and the constructor. Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#109051) next »