Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93501 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71201 invoked from network); 25 May 2016 13:03:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 May 2016 13:03:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.180 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.180 mail-yw0-f180.google.com Received: from [209.85.161.180] ([209.85.161.180:34659] helo=mail-yw0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DB/21-63510-782A5475 for ; Wed, 25 May 2016 09:03:03 -0400 Received: by mail-yw0-f180.google.com with SMTP id c127so46327515ywb.1 for ; Wed, 25 May 2016 06:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=hq2GC8gC7abdGI+U0LJ8bY5uXajk+oN8t0JXLRrowVw=; b=YiItcRakES26RD25oiy/D1+ZR8m1YkNU1iKrJwVAZ6od/ycUlGOrwLTlG6p0933Ie2 Xski4X6pWXtXzuE3vq0xQt8ROTnom6vtTKmWxImBDTITTgcpFwlXYC40XnRdvb3IL6Np bn7zKCYs3eRlwcGoojXr2gOYGWm1JPD35M4MDTAibLYyrssKH9U+kYsPvkfYqzO93ziT 8qjmJZE4Je27FVjofb/hZE4MRs+CduH++KBcCb+w5Y3dT5Zfipqz9Ciil79kWSffWJEd kKXLiB+9gi5q35P3eYbxRyeesfVNcldjFSrpuHCR5OVPfzjskokbP/ZBCTmHvldNNhv/ UiLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=hq2GC8gC7abdGI+U0LJ8bY5uXajk+oN8t0JXLRrowVw=; b=hgovVpcJiNo6xsCbgdlY3zG6EjDzhsjQctGHbFX16lke7sPRQ8P0Opw/sTd5iGklG6 2jb1NoKEvMgKFP4lSjfWw0tyDFPA2/6dcjpdz3SxYsjQmBkkQMzAKRkwuhHwXFL93min fbI7JSPu2SSVUE1KhLd2Nz0nEf/Dkg+kvu1XyWW0OD9+UC9Pdkr6hAu2HF8Bujg4VMKr MgwV1lONgunK9DyxunrfzZ1RMbzILlfz2fxZJPonnJTu5FXhh1rrvJRJtU9Ee8gOsuzC f/2UvBaOZrn5+Y929/RGIvDAKXHkyYTX7VSsDxmYtza/bbkP0eAzDDt+MCQut24tPS0x XHCQ== X-Gm-Message-State: ALyK8tKCeJCKRtJdB285herrg8YlBfvqmc5dOA/rlVifhSU5f3sDKjscq7MnWsgLzxjsGHvBgnqRpMvVZGOXxQ== MIME-Version: 1.0 X-Received: by 10.129.40.69 with SMTP id o66mr2154445ywo.221.1464181381102; Wed, 25 May 2016 06:03:01 -0700 (PDT) Received: by 10.13.239.3 with HTTP; Wed, 25 May 2016 06:03:00 -0700 (PDT) In-Reply-To: References: Date: Wed, 25 May 2016 15:03:00 +0200 Message-ID: To: Joe Watkins Cc: Dmitry Stogov , PHP internals , Phil Sturgeon , Bob Weinand Content-Type: multipart/alternative; boundary=001a1140723a1b862a0533aa4b8d Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: nikita.ppv@gmail.com (Nikita Popov) --001a1140723a1b862a0533aa4b8d Content-Type: text/plain; charset=UTF-8 On Wed, May 25, 2016 at 10:30 AM, Joe Watkins wrote: > Morning Dmitry, > > > I made this check(s) to be invariant. You may like to do this > differently... > > I think this is what everyone expects, isn't it ? > > I did omit to mention that part ... > > > RFC doesn't define how uninitialized nullable typed properties should > behave. > > It does: > > > *Nullable typed properties will not raise an exception when accessed > before initialization.* > I don't agree with this choice, for three reasons: a) This unnecessarily restricts what can be expressed in the type system. With these semantics it will no longer be possible to express that a property should be nullable, but have no default value. This situation is not uncommon in practice, in particular anytime you have a nullable constructor argument, you will want the corresponding property to be nullable without a default, to ensure that it is explicitly initialized. b) This directly contradicts the meaning of ?Type for parameters. For parameters ?Type means that it's a nullable parameter **without a default value**. That's the very thing that distinguishes it from the Type $prop = null syntax. And now ?Type for properties should mean the exact opposite? c) If you view this in a larger scope of union types, this *special case* becomes even more weird. Why does the particular union Type|null get special treatment, while all other unions don't? Or is it actually not specific to "null", but to single value types? E.g. if we also allowed Type|false, would that also receive an implicit false default value? What about the type null|false? Does that get an implicit default, and if so, which? I realize this is not quite in scope for type properties, but the further evolution of the type system should be kept in mind. Please keep things consistent: If there is not default, there is no default. Nikita --001a1140723a1b862a0533aa4b8d--