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

From: Date: Mon, 16 Mar 2020 11:41:22 +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 19  Groups: php.internals 
Request: Send a blank email to internals+get-109053@lists.php.net to get a copy of this message
On Mon, Mar 16, 2020 at 4:47 AM Rowan Tommins <rowan.collins@gmail.com> wrote: > 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. Interesting, so if I understand you correctly, you think of a property with an initial/default value to be *initialized* before the constructor, but a property without it is *initialized* in the constructor or later (at first assignment of value)? Is this concept of initialized/non-initialized properties something that is more or less well-described in the language? If so, I'd like to read it. Seems like a fuzzy concept to me so far, unfortunately...

« previous php.internals (#109053) next »