Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92590 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62795 invoked from network); 21 Apr 2016 11:00:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Apr 2016 11:00:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=cornelius.howl@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cornelius.howl@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.41 as permitted sender) X-PHP-List-Original-Sender: cornelius.howl@gmail.com X-Host-Fingerprint: 209.85.218.41 mail-oi0-f41.google.com Received: from [209.85.218.41] ([209.85.218.41:32805] helo=mail-oi0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/5E-14036-BB2B8175 for ; Thu, 21 Apr 2016 07:00:12 -0400 Received: by mail-oi0-f41.google.com with SMTP id r78so78117510oie.0 for ; Thu, 21 Apr 2016 04:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc; bh=naOQTw+L5k42RiQaKUpnKFVpdJWBW8rx5d08LeYv044=; b=bvaXKStsZwlD/f0Sbn3ih31P1qTA+DvAuhAbZ3YzrTIMmt6NJtwVEU4311E3aM5jZj tRTUXJMmqH40+s4TY5teVMmj6VKjkxaKumBqUGhlw0lmtneEGvkbmVcGWF3fY6TvaSM+ BDz6zWtE3FN+LBLbJTLWyhYhG6f5fKkfDs3sq3rTLeiRgfJepmowdK1YATR6Mqemd/SC eEZ27732xrK0+uO6hQDnNgRgHevDx7JatO0EfXpD4HPrOuNihj2MieDSHt7uMXInjo9k w3urit0WU8eGWRHYpLnWAOXiGQZgMK/vfzt5Ee4X9ll6za+xv5gCJY6ehtgGmr9TGDoz u0dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=naOQTw+L5k42RiQaKUpnKFVpdJWBW8rx5d08LeYv044=; b=FojuQHZNKeZee3kQ7elDdTgdwSzlciIdS+zMLxfNvNDfjRiY+CTkRIH+holXCwsa26 8KSVqaj259r59QBkpquCliwjwLi/Aq+Re9CKqIS5a2QrzHgR1nD7Y7d5fjjjPK2SIqjY AdJPB4j4ap6LjG2rUnIcZUuEE6uzMS5UQDbIzwp5IL/6txGl5hbnYTpVF5CHss9cd0hr UieORnS+K0DD7uEA5jFuXTHMiytyLh4pBRLNiOodaGqmUc9bH1FpurbVy83HVF0kjkm2 Z1rh76P2r39WVV/l9jr/DN4i1P5Pu0sXKIWLmpbHRjef751Cz0mri+i+b7uLZv1h0IUe cDiQ== X-Gm-Message-State: AOPr4FXTLWsSSSXNWLMEir5cKS2K/yp8tQ75fORcbGrW8TqwCRxE6MkYF8+hgneK1jcPHykCI7Dl7LJUyuwqGA== MIME-Version: 1.0 X-Received: by 10.157.4.174 with SMTP id 43mr5322089otm.127.1461236406327; Thu, 21 Apr 2016 04:00:06 -0700 (PDT) Received: by 10.157.7.194 with HTTP; Thu, 21 Apr 2016 04:00:06 -0700 (PDT) Date: Thu, 21 Apr 2016 19:00:06 +0800 Message-ID: To: "guilhermeblanco@gmail.com" Cc: Dmitry Stogov , Tom Worster , internals Content-Type: multipart/alternative; boundary=94eb2c09d9d0eea2d80530fc9cd5 Subject: Re: [PHP-DEV] [RFC] Nullable Types From: cornelius.howl@gmail.com (Lin Yo-An) --94eb2c09d9d0eea2d80530fc9cd5 Content-Type: text/plain; charset=UTF-8 On Wed, Apr 20, 2016 at 11:05 PM, guilhermeblanco@gmail.com < guilhermeblanco@gmail.com> wrote: > > Dmitry is even involved in the discussion of having IS_UNDEF until > constructor ends, then enforcing type hinting at the end of constructor to > trigger potential invalid instance state. It created a mess in the internal > structure by creating a 3-state value: uninitialized, absent of value > (null) and assigned value. All this problem would be solved by merging null > into accepted value. > So far the proposed solution there to take a wrong assumption to assume a > default value based on type defined (like int = 0, string = '', etc), which > are all potential valid values, leading to unpredictable behavior if a > develop misses to assign a value to that property. > > Sure, people will say that now PHP will require a NullPointerException, > PHP is turning into Java, or that I don't know what I'm talking about > because they coded for Amiga and I don't (yes, I've seen that already in > this mailing list). But the fact is that keeping control of 3-state flags > are hard to maintain. > I think this is not to make PHP like Java, and it totally makes sense - Nullable should be a type of a type instead of a state. In Haskell it's named Maybe or Option, and It's better than NullPointerException. Here is a discussion from Haskell community: https://mail.haskell.org/pipermail/haskell-cafe/2011-April/091269.html -- Best Regards, Yo-An Lin --94eb2c09d9d0eea2d80530fc9cd5--