Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91861 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40442 invoked from network); 22 Mar 2016 18:44:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Mar 2016 18:44:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.25 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.25 out1-smtp.messagingengine.com Received: from [66.111.4.25] ([66.111.4.25:55154] helo=out1-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 93/12-30596-D8291F65 for ; Tue, 22 Mar 2016 13:44:29 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 2D36F202A0 for ; Tue, 22 Mar 2016 14:44:27 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Tue, 22 Mar 2016 14:44:27 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=VuGVw6i6rw825Yn pffsY44gCadc=; b=s/1uEAcPeWiNfJptIQag0I6/4brF9nDOhTGKdxyCe2o8TxR qrqPmQBv/kzvGEEPPBqSB4pHZ3k1Djqvv3dONVF3jr8zuHWeB0Le/Rd07wW6DkXS LS/pzAtIrq4C0aKcdOjSA3wudf0wgMR33GQ3dYPVrYt3bv5iNCNLwIxjKdVY= X-Sasl-enc: zbKBQCCUk+9HVQa1DD3Tn7n4qfA5WldlEb6BKQepWOCP 1458672266 Received: from Crells-MacBook-Pro.local (unknown [63.250.249.138]) by mail.messagingengine.com (Postfix) with ESMTPA id E42556800F5 for ; Tue, 22 Mar 2016 14:44:26 -0400 (EDT) To: internals@lists.php.net References: <53.61.30596.65091F65@pb1.pair.com> Message-ID: <56F1928A.2030902@garfieldtech.com> Date: Tue, 22 Mar 2016 13:44:26 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <53.61.30596.65091F65@pb1.pair.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: RFC Proposal: Maybe monad and execution timepolymorphic methods From: larry@garfieldtech.com (Larry Garfield) On 3/22/16 1:34 PM, Stephen Coakley wrote: > On 03/21/2016 11:09 PM, Levi Morrison wrote: >> This requires you to query state with `isSome()`. This is hardly any >> different from a null case, just more code. We can already accurately >> distinguish between `null` and another value. >> >> If we want an option for safer PHP code I think we need a safer >> construct that requires exhaustive matching (such as Rust's `match`). >> I'm not sure how to pull that off. >> > > Certainly. Ideally some sort of `match`, which is listed as future > scope in the enum RFC. The above definition of a Maybe is just some > sort of basis for a type. You probably wouldn't use `isSome()` much > and would use pattern matching on the enum instead. > > As much as I do love Rust's type system though, PHP isn't Rust. :) Correct. So we should just sneak up behind Rust, pick it's pocket, and steal the bits that we can make work for us. That's what PHP's always done to every other language we've encountered. :-) -- --Larry Garfield