Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91826 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36001 invoked from network); 21 Mar 2016 20:27:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Mar 2016 20:27:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.180 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.192.180 mail-pf0-f180.google.com Received: from [209.85.192.180] ([209.85.192.180:34450] helo=mail-pf0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 29/21-29631-E4950F65 for ; Mon, 21 Mar 2016 15:27:58 -0500 Received: by mail-pf0-f180.google.com with SMTP id x3so277885999pfb.1 for ; Mon, 21 Mar 2016 13:27:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=F0qk74R4ijX1qC1e3kwWvK9MozAioovCo+SLCfvjonA=; b=Fsl5ubxFZavEk9+ZRk2JJyZp9yzVdETP7GbkSqhf9EizogvKe4D7K6vVOml5rWdiyQ UkXzoLlGPNOLFMKVEOqlmx8r60OE7GWn/PqWqckJMVaYPS/8QSQ4ElMI/88dkqFM5jhm tBtEB8Gxi53JHHeM9ikUbendiDp9UTr3EWI+ZMiLxprPa7Fc5jpV7o9BNJ8zHEXPVRCF uiucoT/eVof5h4cjr21SWKeNtjtJQxaDdyyr/g/zCgGz3GrjuHQNSCrMdqV0degaBmlT jD28AT2EsEttadPMwLDcgkk/kPXAM/idzRKxGWPMXtOB2ZwbcrL0JwdYD767v8fNr244 hM4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=F0qk74R4ijX1qC1e3kwWvK9MozAioovCo+SLCfvjonA=; b=d/HRdj8ED2ryFg1O8IsZk9bgeycZbdF4f77juKiqrzbLQEX7njPvFxfbpcBNJdO3H+ pIkB5Q6JXwumIAtLsYf5X/tU2uS0JkZlQNVHM/ebqoQNjadH6efWN/YyYdYkHPxM0DGr fY8ixxt5AoKLbyhmyEYZk1bN7YCC+yKbebxvLD1L67ZlngxrGDaCfjzy8ZeFnVPbnw47 hlOqZxylaK3y0czblwZkcK34PCl4bY1mF9i2COKuNqWNKeSHDePg82rJr8o49i+sdWZz H2cEtChzZW/J58ttc4v38+MWztp8MgDAX8pXvAdHWmLQ/ipU3EgzGpjj1d7yrKBWwdFD QVfA== X-Gm-Message-State: AD7BkJJMxbpBSpydBWBrMNA+ddRYGF09rqx6zLqQv4qCpOhJc4Mfx4Am0sSdAS/dIfCfXyRsck4UikZ6ZnNGUg== MIME-Version: 1.0 X-Received: by 10.98.14.68 with SMTP id w65mr48450992pfi.144.1458592075545; Mon, 21 Mar 2016 13:27:55 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.66.163.232 with HTTP; Mon, 21 Mar 2016 13:27:55 -0700 (PDT) In-Reply-To: References: Date: Mon, 21 Mar 2016 14:27:55 -0600 X-Google-Sender-Auth: g2kq3vU8aa3k0Rer6VGI9sRare4 Message-ID: To: Facundo Martinez Correa Cc: internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] RFC Proposal: Maybe monad and execution time polymorphic methods From: levim@php.net (Levi Morrison) > My experience in Haskell reminded me of this. To have a structure than > represents uncertainty, is the best way to take away the responsibility > from NULL. To express it in no other way. But my experience in Java has > taught me that Optional of something is not a good way to tackle the > problem. I still have to check if my Optional isEmpty. I still have to > check for null. That is because Java has that type erasure after > compilation time that doesn't allow me to play nice with polymorphism. But > 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 > for null ever again in my life. So my code can be free of nulls. So I can > express uncertainty and nonexistance, while I return a User from my > repository. I don't fully understand what you are asking for here. You want a Maybe to automatically become a T if it's not null or something?