On Tue, Nov 3, 2020, 7:58 PM Benjamin Morel <[email protected]> wrote:
> Hi, > > It currently returns null but issues a warning (which can be, and often > is, converted to an exception by frameworks / custom error handlers): > https://3v4l.org/1ZkVC > > The new operator returns null with no warning: > https://3v4l.org/Wmun4 > > Benjamin > > On Tue, 3 Nov 2020 at 18:09, Eugene Sidelnyk <[email protected]> wrote: > >> But currently working code doesn't fail with NullPointerException? >> Otherwise it would not be a working code. >> Early fail will be when we try return / pass anywhere this value >> >> On Tue, Nov 3, 2020, 6:48 PM Benjamin Morel <[email protected]> >> wrote: >> >>> On Tue, 3 Nov 2020 at 17:38, Eugene Sidelnyk <[email protected]> >>> wrote: >>> >>>> I am wondering why don't we use ordinary `->` operator with safe null >>>> handling? >>> >>> >>> Hi, >>> >>> - changing the current behaviour of `->` would be a huge BC break >>> - and if we need another reason, there are many situations where you do >>> want to fail early if the left operand is null, so the current operator is >>> a good fit >>> >>> — Benjamin >>> >>
