Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111028 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 39303 invoked from network); 15 Jul 2020 18:22:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Jul 2020 18:22:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 56535180532 for ; Wed, 15 Jul 2020 10:15:01 -0700 (PDT) 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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 15 Jul 2020 10:15:00 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id CDE6EC62 for ; Wed, 15 Jul 2020 13:14:59 -0400 (EDT) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Wed, 15 Jul 2020 13:14:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=RDZQEZ kTTTZwnqOTi/u3dao6mRwBdbTvOBZly30yYH0=; b=j1tw1SV5Z3m4EvtDoBu+a/ 3CInlre5ptnU2s4XhsaGhD8FFDoWnYmrtyDI8B4z66ncLfO434XFfgeHWSK3UbE/ vN/uCGF4UWkQCOaCNdmXq1K8q10NxyQBf6OvCvYvfO29mIGzOptP2lxbemNduwHu riG1/xN3x49/hcALfA6ok98v+fl6iwpI4bzT3iLqlvmkZ8vWrsF+CVIBkERbsQfS HBQgT8w7B33zP00B3mlBhdFNROIv+8ZjoZJ+Tlw58KBlwvHjG1tVduYbZPr2k2ry 0P/fTRZsHuhgDuG8tXX1uDU9QDF0zXTwUbeC2TO+Cij3XcHkzr+AD+cbEa3jeK8A == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrfedvgdduudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeekteelheffgeefvddufeeujeekhfdvtdeuuedvveet ieevheeludegjeduhffhteenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgr rhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id E2FE014200A2; Wed, 15 Jul 2020 13:14:58 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-dev0-613-g8a73ad6-fm-20200709.001-g8a73ad6e Mime-Version: 1.0 Message-ID: <1a34b907-4766-4c13-9da3-34a3df527679@www.fastmail.com> In-Reply-To: References: <21C5073D-3F39-49DA-8686-E027AE780793@joshbruce.dev> <2d0fea79-0729-4cce-8b3a-be834614f242@www.fastmail.com> Date: Wed, 15 Jul 2020 12:14:36 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable From: larry@garfieldtech.com ("Larry Garfield") On Wed, Jul 15, 2020, at 11:59 AM, Marco Pivetta wrote: > Hey Larry, > > > > On Wed, Jul 15, 2020 at 6:55 PM Larry Garfield > wrote: > > > I disagree entirely. The value of a Maybe over just null is > > > > 1) You can bind to it even if the result is empty; the "if is null" check > > gets abstracted away from the main code. > > > > That's correct: that's how the `Maybe` monad works too. That... is what I'm describing? A Maybe Monad? > > 2) You are forced to unwrap/extract the value if you're not just binding, > > which makes it less likely you'll forget to check if it's null > > > No need to unwrap: that's what `>>=` does for you. > > Assuming you use psalm or phpstan, a program that doesn't use `>>=`, or > forgets to check for `null` on `?T` does not type-check anyway, and can be > rejected before even writing any runtime tests: that's sound. > > Marco Pivetta My Haskell experience is zilch, but since PHP lacks a dedicated bind operator that also magically unwraps, that doesn't seem relevant. (Mind you, I'd be all for a dedicated bind operator that also auto-unwraps! But that's not on the radar at the moment.) --Larry Garfield