Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92655 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9882 invoked from network); 23 Apr 2016 12:31:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Apr 2016 12:31:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.87 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.87 mx106.easyname.com Received: from [77.244.243.87] ([77.244.243.87:55793] helo=mx201.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/30-07837-E0B6B175 for ; Sat, 23 Apr 2016 08:31:11 -0400 Received: from cable-81-173-133-226.netcologne.de ([81.173.133.226] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1atwiJ-0002Ws-5w; Sat, 23 Apr 2016 12:31:07 +0000 Reply-To: internals@lists.php.net References: <57192F87.4080902@fleshgrinder.com> To: Quim Calpe , PHP internals Message-ID: <571B6AF6.5030001@fleshgrinder.com> Date: Sat, 23 Apr 2016 14:30:46 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bw3xdO9eGtk2nN6nH54DqOdgB0VA10gKO" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC] Nullable Types From: php@fleshgrinder.com (Fleshgrinder) --bw3xdO9eGtk2nN6nH54DqOdgB0VA10gKO Content-Type: multipart/mixed; boundary="dmCTPBBOL4Hx7wPhtwpkjCts1m6thGqoS" From: Fleshgrinder Reply-To: internals@lists.php.net To: Quim Calpe , PHP internals Message-ID: <571B6AF6.5030001@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC] Nullable Types References: <57192F87.4080902@fleshgrinder.com> In-Reply-To: --dmCTPBBOL4Hx7wPhtwpkjCts1m6thGqoS Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/22/2016 11:42 AM, Quim Calpe wrote: > IMHO, the point of Optional types is the intention, if you get an > Option from a method, you have to deal with a None branch. Of cour= se > you can just unwrap and go on, but it's a developer decision to do that= , > not an oversight as using a Foo|null (or ?Foo) as an object directly. >=20 IMOH, the point of ?T is the intention, if you get a null from a method, you have to deal with a null branch. Of course you can just ignore it and go on, but it's a developer decision to do that, not an oversight as using a Option as an object directly. Sorry, but this works in both directions. The problem is not null, the problem is that there is no system that warns you (e.g. a compiler) about the missing null check. I think that Ceylon solved this problem extremely nicely without the introduction of something special. function fn(): ?T {} $x =3D fn(); if (is $x T) {} else {} Not doing as above is a compiler error in Ceylon. However, I already wrote multiple times that there are already statical code analysis tools available that can find exactly such things in your code. One just needs to use them. --=20 Richard "Fleshgrinder" Fussenegger --dmCTPBBOL4Hx7wPhtwpkjCts1m6thGqoS-- --bw3xdO9eGtk2nN6nH54DqOdgB0VA10gKO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXG2r6AAoJEOKkKcqFPVVre58P/R71CA4PJ2F5KHNdEH4yc34z DG2RWNFd56nkrYY4XQmWjLqBnamdWE3j6xCc9/voKK0quAb4CVogBS2p5ZnrViLF VFBfNDxZH79xIBREhLmTvS5Z8/1qm0dlOErXkuPcv6xLXFQHKXt4RsLMlSavDUT9 nqmzpKGM9sMXfuh5t7jrxVRlBdHWq0MPVjUJlwscV7erHilZOqVzii7kmZuKOB/L Z70RkdFtQ9WJSU8bGgRKenB5pmSjuawQ8l3veZ4JM2bUIwlzE9Vu1FmWYwfYwWDe d1wqneaxCepj1Nyq/wz7IDCSnzIhyrR0QdHYR9pYB2zLtCfkGLvYbBl0D0/qjnz1 pM3Jv27CZaCpIXPsP+4v8OJPEOiipZXUBWZ4iaV+yAhLPnQ2QnLuU4MMdD0AtUwy vCnXpHnG+C8EFojtiNseLdQVAS15qPi+Y2h9j7ELKoveioOlyCE8o+08PVP3OQpP 8NUkR+R3pU9vj7SFXGUw/e5d9GAQhKZWUG6RM+8o304wvCAF5r4l8kekpUeHJ7Be ++RGGvW9EPi3zKOBc/pxS2CXctVoY9bqOqlGN8CD9UsF+Czoq+uQ3QmFg+WNzR+i +bPhz8Qo31nznDseww7Pzd4e29/+9svac2rH7VJRJ8ki2PT3S/V3fsEIEIxmrSDk 8cthJLJjoObOaBUMwKdI =yAPl -----END PGP SIGNATURE----- --bw3xdO9eGtk2nN6nH54DqOdgB0VA10gKO--