Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93502 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73314 invoked from network); 25 May 2016 13:22:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 May 2016 13:22:06 -0000 Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.161.178 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.161.178 mail-yw0-f178.google.com Received: from [209.85.161.178] ([209.85.161.178:35889] helo=mail-yw0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5B/81-63510-DF6A5475 for ; Wed, 25 May 2016 09:22:06 -0400 Received: by mail-yw0-f178.google.com with SMTP id x189so46793619ywe.3 for ; Wed, 25 May 2016 06:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pthreads-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=gHUBmpaCRdDbrLGPDD5q+R0gnNipWbIOdPy6yGRW4zQ=; b=Lz8ue7VjGgm9FAyJPUWaOtDc8uJnve3XENj+b8VyiTOXRn5PuD9hnox0WcJ6sMo8Sr x9Ew1GF+WZoiSum3qq9bZImcQC2fLc+J21RCzLR3EHHc0F9q0jga/H5ubX9M5cgWlPaU wPOvMlGuKB+28FPDGjAF0KZMaZROselPrhDlGrynAM3n7RWsqxKfDjNWG42HjEpyWpLl q/Sei1SWsrOc8vRoBIlVcg5gtR8vrBIqo8rr4veuy/m/YqK/s6sBuG8blBbDZjWXjC7U EDbPWKfTRNkMlhbKQ/Er33Jwf8Tnd6l/nVrOWXaAQMHuDi1WSr9U4sMgbk0wcyOzEHWD xg6Q== 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=gHUBmpaCRdDbrLGPDD5q+R0gnNipWbIOdPy6yGRW4zQ=; b=Xciw6jcztpx0LrVNB+9CETKHdjLmEgbxq5SO8fWwLRZxdxf9AiIwxHLsSBBxNR/pY4 c/Xt05nHmm5KvNps5HGxMoeEJ2B9/DO6gtIa55rkeNPxxLUOuXjtQMN44TnaqIsOOoSK BSojE1oqglhUmcS5OusP6ulB1ATPNTDZRBOJd4WdHMlnmie1rWH4dR2onYIGpEXxx/0K 1zL6z6s42B0OUj7OSHp/1B0jNCvRI/Xya4OpGRLKgUmsQmNGL+70vQdjpFogTf1fpyPW 5WoiN43xMrlPmNTFP2uXw3PGNZWYKcD5fQXY1Q1F63+7ORwN9dn8r+emXPyXlff6rTqs rf/g== X-Gm-Message-State: ALyK8tLlxi4lTho83sPVdHQs+pq9Hwcr1uxlWjggT+oAWQ4FS20mobLfpCVvn8oa5APVEuMt/zo/VQiIXjG3wg== MIME-Version: 1.0 X-Received: by 10.37.222.198 with SMTP id v189mr2153143ybg.135.1464182523001; Wed, 25 May 2016 06:22:03 -0700 (PDT) Received: by 10.129.109.67 with HTTP; Wed, 25 May 2016 06:22:02 -0700 (PDT) X-Originating-IP: [109.157.60.67] In-Reply-To: References: Date: Wed, 25 May 2016 14:22:02 +0100 Message-ID: To: Nikita Popov Cc: Dmitry Stogov , PHP internals , Phil Sturgeon , Bob Weinand Content-Type: multipart/alternative; boundary=94eb2c0872bc2bb4520533aa8faf Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: pthreads@pthreads.org (Joe Watkins) --94eb2c0872bc2bb4520533aa8faf Content-Type: text/plain; charset=UTF-8 Morning Nikita, That's pretty persuasive ... Dmitry, what are your thoughts on those points ? Cheers Joe On Wed, May 25, 2016 at 2:03 PM, Nikita Popov wrote: > 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 > --94eb2c0872bc2bb4520533aa8faf--