In addition to your question about impact on the performance, there is
none. As there is no special tracking of those references just control
check when you try to write by reference.
2018-02-23 14:40 GMT+01:00 Silvio Marijić <marijic.sil...@gmail.com>:
> Hi Rowan,
> I agree that RFC needs a bit refinement which I hope to do during ongoing
> discussion here.
> Originally you couldn't assign following types to an immutable property
> - *Resource*
> - *Instance of none-immutable class *
> Now I had to resort to also add *array* to that list.
> Regarding your question about references, yes you can obtain reference to
> an immutable property but you can not modify that property by reference. In
> that case it will throw fatal error, but I agree that it would be better to
> throw exception, I will include that in RFC.
> Thanks for the support I really appreciate it.
> 2018-02-22 10:57 GMT+01:00 Rowan Collins <rowan.coll...@gmail.com>:
>> On 20 February 2018 at 11:25, Nikita Popov <nikita....@gmail.com> wrote:
>> > On Tue, Feb 20, 2018 at 12:20 PM, Silvio Marijić <
>> > >
>> > wrote:
>> > > Hi,
>> > > I am starting this discussion again after a year since this RFC was
>> > > created. From discussions with people in the community some
>> > > came up regarding issues that were main reason that development on
>> > RFC
>> > > stopped. RFC is updated along with implementation (link at the bottom
>> > > 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.
>> Rowan Collins
> Silvio Marijić
> Software Engineer