---------- Forwarded message --------- From: Eugene Sidelnyk <zsidel...@gmail.com> Date: Tue, Nov 3, 2020 at 9:05 PM Subject: Re: [PHP-DEV] Nullsafe To: G. P. B. <george.bany...@gmail.com>
Null value by itself was invented to indicate lack of data. But we can't just use it instead of objects, because of how it works. We need to create a boilerplate of NullObjects. Consider the abstract factory example: https://3v4l.org/9D9LU The problem is not with nullsafe operator. It is basically in null constant. To correctly work with absence of object, NullObjects is required (one for each abstraction). > I don't see why users should return null values more often. They should not return null values! But with nullsafe they will be prone to. On Tue, Nov 3, 2020 at 8:33 PM G. P. B. <george.bany...@gmail.com> wrote: > On Tue, 3 Nov 2020 at 16:48, Benjamin Morel <benjamin.mo...@gmail.com> > wrote: > >> On Tue, 3 Nov 2020 at 17:38, Eugene Sidelnyk <zsidel...@gmail.com> wrote: >> >> > I am wondering why don't we use ordinary `->` operator with safe null >> > handling? >> > > Implicit nullable is terrible, moreover I don't see why users should > return null values more often. > They serve their purpose but most of the time you can use another > sane/safe default of the given > property type. > > Moreover, I don't see the issue with another operator as it conveys > *clear* intent especially in > PHP as everything is `null` by default (might warn but still). > > *Technically* this isn't a BC break, but it's an enormous change of > semantics for something > which is worse IMHO. Also the operator has already been voted on, > accepted, and implemented. > > Regards, > > George P. Banyard >