Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91758 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81247 invoked from network); 19 Mar 2016 04:04:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Mar 2016 04:04:32 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.26 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.26 out2-smtp.messagingengine.com Received: from [66.111.4.26] ([66.111.4.26:53771] helo=out2-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3E/41-03097-ECFCCE65 for ; Fri, 18 Mar 2016 23:04:30 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id ED5E520979 for ; Sat, 19 Mar 2016 00:04:27 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Sat, 19 Mar 2016 00:04: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=4UCXt6Yi84wtVPv BunIRVGg6I/M=; b=mpMAGAdbSnX0kurZie5YmfyP/NoqQ0bcPMZ4cKmM2MdJoen Y+e8wwebq6o6OgNffs3/KNxI7iaXlOA+dd3eOGjbO8DYWyN2MIyfxtKH302dlams Hf6urRqpWcLlYfxtYaOenOJ8u/WpbD2X4Pa8E7CR9YdtrPNm019y53kLdTcU= X-Sasl-enc: 1Q/iWaSZ83sgYO9iCrSXTPkoP8Tq8DtNi9wTFpoi4XBX 1458360267 Received: from [192.168.42.5] (c-50-178-40-84.hsd1.il.comcast.net [50.178.40.84]) by mail.messagingengine.com (Postfix) with ESMTPA id 9D87EC00012 for ; Sat, 19 Mar 2016 00:04:27 -0400 (EDT) To: internals@lists.php.net References: <56EC69EF.1090003@fleshgrinder.com> Message-ID: <56ECCFCB.6090105@garfieldtech.com> Date: Fri, 18 Mar 2016 23:04:27 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56EC69EF.1090003@fleshgrinder.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties From: larry@garfieldtech.com (Larry Garfield) On 03/18/2016 03:49 PM, Fleshgrinder wrote: > First a general note on the complete nullability first: It is not up to > us as language designers to decide whether it is good practice to use > nullable properties or not. It is supported by many systems since ages > (e.g. SQL where nullable fields are also not recommended but heck they > are useful) and it is common practice in PHP. Hence, there must be > support for it. That does not mean that it is endorsed in any way by us, > it is just there for people who need it for the same reasons they needed > it in the past 20 or so years. At the risk of a small tangent, I cannot agree at all here. The whole point of language design is to make decisions regarding what "good practices" to encourage, enforce, or disallow. Some languages disallow mutable variables (despite them being useful). Some languages disallow global variables (despite them being occasionally useful). Some languages disallow NULLs (despite them having use cases in many languages). Those are all viable and reasonable decisions for a language designer to make in various circumstances; to say that it's "not up to us as language designers" to make such decisions is to abdicate our responsibility as language designers. There may well be good arguments to allow property nullability. There's also good arguments against it. We'll decide one way or another. But "we shouldn't take a position at all" is worse than taking a position, because that implicitly does take a position (allowing it), while pretending that we didn't. Basically it means lying to ourselves about it, which is never the right answer. Design is about making deliberate, informed decisions. Let's make a deliberate, informed decision. To help with the informed part, can anyone speak to how other languages handle null-typed properties? I believe Java allows everything to be NULL (which sucks), but I'm not sure about other modern languages. Can anyone speak to that? (I'd be particularly interested in Python, Go, and Rust, but any language you can speak to definitively would be valuable to know about. Javascript and Ruby are, AFAIK, insufficiently typed for the question to apply.) --Larry Garfield