Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91982 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35890 invoked from network); 29 Mar 2016 00:13:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Mar 2016 00:13:37 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.175 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.175 mail-pf0-f175.google.com Received: from [209.85.192.175] ([209.85.192.175:33964] helo=mail-pf0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 96/E0-31598-FA8C9F65 for ; Mon, 28 Mar 2016 19:13:37 -0500 Received: by mail-pf0-f175.google.com with SMTP id x3so55323pfb.1 for ; Mon, 28 Mar 2016 17:13:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=aeoD260p4V2WLSLWFiBX83Ot4ubMXhGdXKs/D1Uzwuo=; b=UR16NF0cOPO/dGFFcPI1r/lnstnO7XJBjwAhUyWlo2gdhGbUoRxIL/7ljkz5I8Hgz8 ZDnPQ6fyylaOZR9iIP0tUfLIPT508mhIENURY/EnXKOnemYb5uF4FVqj3t3lqEeRf21X bBGSVa0QnfWdi9nkTh7ZVYBC+Gd/WAxkiSHfQMNdZenY5t1zxZEJnKayaqXcYD4cPELI W4JBIweUqNWn+Rz9T10pWiNfRBo3v2XxfU95+H+hNfecmx7LZkensZfvqSP+zD79g0/O w+EKXS0JKNE/7SpXY5FUuNEUiU3XR/emGjaz+viahPnhXwHzNgIk1R8v/w/rv0tiMhWd gUNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=aeoD260p4V2WLSLWFiBX83Ot4ubMXhGdXKs/D1Uzwuo=; b=YYW4nviSvH6XHqI5VVEgpsEm/8xmV8/yE4wj/9WcHhPF8SsuXMATQ6CQZspeMZB1Gd cMXQkmN0HiXTF4QjtugN375iNucJ1ALcaVORIlXBc4qoLv4w7S58tuGfqIte8YiloQws ajzJYBpDtzknrA4cdBiQGDK+XeZZQItWHit7UB0bUOO9jO2oYjKSh3URlU9wUfFuF4Nf 7BdEV8+NBaGUAhbP9fG96MUgOLzOws9x9lFobTj/CcaMmtLLfIM9CVWDwXECCM9PE9tf 90yssLoO2IjRsTVvrvejAdpSYTq9cwik4ylSfWlwyBnkNUh5o3WUOiFWACQXHszfw/yG SmrA== X-Gm-Message-State: AD7BkJJtu5cueNH1F2mdlY8hhMBYH5/sSjhXNipGBe2mbdq2V2VSBjBHqG4JNyYLOsTpzg== X-Received: by 10.98.9.83 with SMTP id e80mr47078333pfd.34.1459210413574; Mon, 28 Mar 2016 17:13:33 -0700 (PDT) Received: from Stas-Air.local ([2602:304:cdc2:e5f0:388b:45ae:9d21:f641]) by smtp.gmail.com with ESMTPSA id ud5sm30036053pac.11.2016.03.28.17.13.32 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 28 Mar 2016 17:13:32 -0700 (PDT) To: Facundo Martinez Correa , internals@lists.php.net References: Message-ID: <56F9C89F.2000200@gmail.com> Date: Mon, 28 Mar 2016 17:13:19 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC Proposal: Maybe monad and execution time polymorphic methods From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > maybe PHP can. Maybe PHP will give me the polymorphism at execution time to > discern an empty Maybe from the one that is not. So I don't have to check In order for that to work, we should have a facility to: a) define union types b) ensure somehow that code dealing with the union type covers all variants c) if we really want to be able to handle such types smoothly, we need something like monads to be able to convert f(SomeClass $x) to f(Maybe $x). This does not sound trivial at all. (c) is not strictly required for the rest to work, but will also require some kind of generics, since Maybe should have information about contained type (maybe what? maybe file, maybe database connection, maybe pastrami sandwich?). If you give up on (c), you still need some facility like case-of for (b). And, of course, you will still need to write code to cover the "nothing" case of the Maybe. So it might be easier getting a code analyzer that would just identify missing null checks? -- Stas Malyshev smalyshev@gmail.com