Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112167 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30245 invoked from network); 3 Nov 2020 19:59:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Nov 2020 19:59:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 277B41804B3 for ; Tue, 3 Nov 2020 11:19:34 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 3 Nov 2020 11:19:33 -0800 (PST) Received: by mail-lf1-f44.google.com with SMTP id f9so23769545lfq.2 for ; Tue, 03 Nov 2020 11:19:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=lu/+Q5A2riML2Q6EULvK6Hw/anO8Ur1wPI839tjyQqQ=; b=KzxM/XM76I5OaMvvCcQENoO/ge4WaZasjhWQmt86mEgWNJxyza6kHhHh0nkNjH4fq3 hfEpUo42XLxRxCeHMRvcnMQxeMVM8SLZzDmPiwAWh2pCRDFkiw5t0t/8K+qDJDakLfJS /IYnl+Iw8RxY30esGGsS6+FNNDPxQGlf63UXIWvTXj+VjwDNf26bkUwh/5sm0duUWIMH yzccKFYAiTUOpbqxHGDqLCc1fSo28eZZq/VcNX/9RJfRupnLX3GpiOQCkDH69WpLY/rG 2m7ro8I3iHtiEpSli5s0OBr3vQO/ZMZOIscs3n9Ngg715xseas/4WlGnur+u+rUGyXQ8 lPFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=lu/+Q5A2riML2Q6EULvK6Hw/anO8Ur1wPI839tjyQqQ=; b=LKVehfaGAi+8apU7SMVNj33mF2ZUD2MFjUg2vFLpRMRyI2r6gwfY8Gi3T6cfZTAC6r Ao8JvIKd6wcCjQ+lRR+Uzvucw+sPygK6IKr9F+7nr9gdUjgEq8YGNSGON+ol0jOtMCXj KRVOAe/i5fV3ksj5DU/5uV5SQrHoXRUjrgqfA3TSWkPJ2sl2JOJ3e/VbfR8hsBFZDJM0 EgRaxx+2TgQVLLgATYnh6Qu8upctHe3/4P6ShWC/4otOECvK4sF9U7/hM/xmyu2+hasx ylXrCqhPSghINiWFkHezeRLZaHJvsHXSKgOP4YBu4JvyV2ddpleLGhMgrLyIWwaKi5k6 OH/g== X-Gm-Message-State: AOAM533UMkf8tsrCSwsi3VonZG6fbzjxNV1aV/Qx52v9CBiLEYjHD41m eslmQtPjRrN6zUSNBp8WI3poyuJuGoRndvG5RhSzJjRGk5o= X-Google-Smtp-Source: ABdhPJwTgnQ0vIAzTo1CfQ8jxiHC1xLbpwfxmFVbEHEfAbR6HlpN8E4GU+PRO/RkTnk2xtG6pO2A7dBuLnvHaE2x/yA= X-Received: by 2002:a19:ca4a:: with SMTP id h10mr8931025lfj.110.1604431171988; Tue, 03 Nov 2020 11:19:31 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 3 Nov 2020 21:19:20 +0200 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000012b5d005b338bede" Subject: Fwd: [PHP-DEV] Nullsafe From: zsidelnik@gmail.com (Eugene Sidelnyk) --00000000000012b5d005b338bede Content-Type: text/plain; charset="UTF-8" ---------- Forwarded message --------- From: Eugene Sidelnyk Date: Tue, Nov 3, 2020 at 9:05 PM Subject: Re: [PHP-DEV] Nullsafe To: G. P. B. 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. wrote: > On Tue, 3 Nov 2020 at 16:48, Benjamin Morel > wrote: > >> On Tue, 3 Nov 2020 at 17:38, Eugene Sidelnyk 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 > --00000000000012b5d005b338bede--