Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91734 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14798 invoked from network); 17 Mar 2016 11:37:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2016 11:37:31 -0000 Authentication-Results: pb1.pair.com header.from=me@mprelu.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@mprelu.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mprelu.de from 74.201.84.163 cause and error) X-PHP-List-Original-Sender: me@mprelu.de X-Host-Fingerprint: 74.201.84.163 sender163-mail.zoho.com Received: from [74.201.84.163] ([74.201.84.163:25203] helo=sender163-mail.zoho.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 52/91-05006-9F69AE65 for ; Thu, 17 Mar 2016 06:37:30 -0500 Received: from [192.168.15.85] (88.211.97.99 [88.211.97.99]) by mx.zohomail.com with SMTPS id 1458212523484209.17326271402044; Thu, 17 Mar 2016 04:02:03 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <56EA8EA9.80905@mprelu.de> Date: Thu, 17 Mar 2016 11:02:01 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------090300080107040305040901" X-Zoho-Virus-Status: 1 Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties From: me@mprelu.de (Matt Prelude) --------------090300080107040305040901 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, On 16/03/16 16:36, Phil Sturgeon wrote: > 2. This whole temporary nullability situation, where unset properties > will error on attempted usage if not set. Should they instead error > after the constructor has been called if they are still not holding a > value? I'd have the error at the time of attempted use, if only because it's easier for people trying to introduce typing to existing code. I'd support borrowing the "?" nullable annotation from HackLang for people who want a less strict behavior: public ?string $name; This means that $name can either be a string or the NULL value. It could be argued that this encourages bad practices (using NULL to represent errors, for example) but I think the benefits in providing easier adoption outweigh the negatives. Massive thumbs up from me on typed properties. Might be worth looking at Hack's implementation as they're already doing this. - Matt. --------------090300080107040305040901--