Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111027 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 36566 invoked from network); 15 Jul 2020 18:07:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Jul 2020 18:07:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 99FDC1804F2 for ; Wed, 15 Jul 2020 09:59:51 -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.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-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) (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 ; Wed, 15 Jul 2020 09:59:51 -0700 (PDT) Received: by mail-io1-f51.google.com with SMTP id v8so3016696iox.2 for ; Wed, 15 Jul 2020 09:59:51 -0700 (PDT) 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 :cc; bh=T8yjRZbL8EqUznXdU9gpGPM/pid9gOOZX79z1j702+I=; b=AgLrzHx9gXzmdwzKntdpvyUiZY+7ptmq06XfosRKEaLBZG6Br5cgcyGMqFcf9zLo60 JPbofO0jPz1Ne2nX4jeWNPaieW5fvb2w2xPI0axEW6+EqH+KRE6BEB7WkMjHS8vY+Hnu ntJk1TdBE0zGaeNnlzwe7T3dRFfZa3Xbra8COcZRoiX2zE4KIElhlwRdNz9I3RPATz5s pUHcjV7kuBfrb5dePRyCUaFkRqIW5bdf7CTIjwvD5+Iv7SyYsjPaxMkppp/S8nJlsKVO iJSm4g5RP6HWL73zMv7O4LV+bPMOqGlMbUEy9IVolRahl3ghMv9XJlR/mKELtCZlIBXq 9PqA== 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:cc; bh=T8yjRZbL8EqUznXdU9gpGPM/pid9gOOZX79z1j702+I=; b=BYITN9VGFciT2oD5bFa9VtEgaP/2DWJri+iKJTDda8eI/P8p09kmvb0MnFUcxmRHYA nrth5NM4+l/otY3bEaYj/h9kRTF87FtSO1Ps0UsBLBXP1K/P4g6TD5MEcap+l8/88QTL J0FEb2cBrkpKeP/veThVXMYj8i2lr5x1Wl7/fe9HHVHOv57rTkHVz67jcaaqVpsZXdo9 mqaGv9569eFqy98uh+KN5UozaOMngJ1q4Qb+nsZOJkyBZyqoQvyE+7jo2PQ94ha6RJd/ cah3M3dcMnp/hvhb17VR0fHStOZUJ8H26uDeWMBeSr1jTvDWWFgFJ2f6QsRxM1aCB+Ho uQiw== X-Gm-Message-State: AOAM531j9hWZgQidAWUfdsnomwUxl4srxvo/9gdmtrxcJ7ue5t/XvgjE 9x2r2wnCqDxXjJM8y82HpMvAfbWfU2p9IGwSY1k= X-Google-Smtp-Source: ABdhPJykcQU65uUklH48veVaiAjc+X+nyn8Q1R8UHNRPjtx0CiZrdLXS9fGih3ys4WQqEc5GUI8FAK/n/qo8SwOzTqg= X-Received: by 2002:a02:cf3b:: with SMTP id s27mr362359jar.72.1594832389820; Wed, 15 Jul 2020 09:59:49 -0700 (PDT) MIME-Version: 1.0 References: <21C5073D-3F39-49DA-8686-E027AE780793@joshbruce.dev> <2d0fea79-0729-4cce-8b3a-be834614f242@www.fastmail.com> In-Reply-To: <2d0fea79-0729-4cce-8b3a-be834614f242@www.fastmail.com> Date: Wed, 15 Jul 2020 18:59:38 +0200 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="00000000000012562105aa7ddaf8" Subject: Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable From: ocramius@gmail.com (Marco Pivetta) --00000000000012562105aa7ddaf8 Content-Type: text/plain; charset="UTF-8" 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. > 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 http://twitter.com/Ocramius http://ocramius.github.com/ --00000000000012562105aa7ddaf8--