Hi Niklas, Problem with checking array on assignment is that it could be N dimensions deep and one would have perform check for each item in each dimension for mutable values which could have some performance implications. Regarding constructor call, upon first initialization of object, you are allowed to assign values to properties, after constructor is executed, object is locked. If you try to call again constructor on the same object it would fail as soon as execution reaches first assignment statement because object was already marked as locked.
I agree that it would be better to pass by value but I am not sure how would that impact the way we currently manage objects in object store. Best regards, 2018-02-23 15:47 GMT+01:00 Niklas Keller <m...@kelunik.com>: > Hey, > > > I do have rough idea how to go about arrays possibly without recursive > > scan, I have to try couple of things, it could work if some checks are > > moved to zval level. For now it is in the future scope unless I manage to > > handle the within week or two. > > What's the issue with a one-time runtime check on assignment? > > > First two proposals are valid points. Regarding disabling constructor, > that > > would fail as soon as you try to write properties in constructor since > > object is already "locked". > > You lock the object after the constructor has been called, not > afterwards. If you don't do that, your objects won't be immutable. > > I like the RFC, but generally I think value objects that are passed > by-value instead of by-reference are the better way to solve the > problem. > > Regards, Niklas > -- Silvio Marijić Software Engineer SMSGlobal