On 20 February 2018 at 11:25, Nikita Popov <nikita....@gmail.com> wrote:
> On Tue, Feb 20, 2018 at 12:20 PM, Silvio Marijić <marijic.sil...@gmail.com
> > Hi,
> > I am starting this discussion again after a year since this RFC was
> > created. From discussions with people in the community some suggestions
> > came up regarding issues that were main reason that development on this
> > stopped. RFC is updated along with implementation (link at the bottom of
> > RFC). I'll be more then happy to answer all questions.
> Link: https://wiki.php.net/rfc/immutability :)
This definitely seems like an exciting addition to the language. Some
This sentence in the RFC is rather confusing, "Any references to objects
... cannot be references to scalars ... or may be ...". I think it's just
reiterating things said elsewhere in the RFC, but could maybe be reworded?
> Any references to objects passed into an immutable class constructor
cannot be references to scalars or may be immutable class instances.
A set of bullet points of what types can and can't be assigned to an
immutable property might be useful.
The example under "references" shows a reference being successfully taken
to an immutable property, but then being considered immutable itself. Is
there any performance penalty to tracking this extra state? I know
references have caused problems in other cases, like the typed properties
What kind of error is produced when you attempt to write to an immutable
property? I would expect some sub-class of Error to be thrown, but the RFC
currently just says a fatal error.
As I say, I like the idea, and thanks for working on it.