Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103180 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 4897 invoked from network); 19 Sep 2018 16:31:57 -0000 Received: from unknown (HELO mail-io1-f66.google.com) (209.85.166.66) by pb1.pair.com with SMTP; 19 Sep 2018 16:31:57 -0000 Received: by mail-io1-f66.google.com with SMTP id v14-v6so4328332iob.4 for ; Wed, 19 Sep 2018 05:38:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=L5n0V7fDUOrog7W9XQK2+h+f+ZtJ5mJCinWHId0tK0c=; b=O7PS+owHB4y8nmeuDDVWL5s9wneVOtYWQxA5p4d/sS7K5ufx3CzMJp3Q/ofOzgJSO/ TX5OnX3ZyAs2iVFZ4GFYtJc4pE2tVTnjKSzesViD9FhN0iDCZqNJR0jAmrzFVFk5vQJl Ok88O8a6QEpHz1p99Vjzngi1x9cRPG7iVKd9MrL3r5ZzWzDAKRsL4RG+ZzV4/I6CB+6R MZ7Q8RiXO7MMmNs4i86yj1bNxGbFj1XtxutLi1V/1TgmCHvr3ExNOugFOcCeOYlo6KpP 78hx5Mgxxt/IJnad9W0PDqg83pdyX6zkP2R8KCHR09usyXUFo2qUlVlUOZLwCovPZZFw sL3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=L5n0V7fDUOrog7W9XQK2+h+f+ZtJ5mJCinWHId0tK0c=; b=C5sdb6G3Ebhsx5YF/L5OHD3aAcZpODTcZe2K7BzzABv/HWI77vsd+M5rygTfyxlEY3 U90TKMTac5xmKb2+8l02QSI/cqNXuiPPKUe1NKhmma5e4fDSf25r0Fe/dtHb3csGnQUG QPXwJ53As7ZenxchhCGgp8Th0EAvmzcxoi5vFwqKBKl3KZpZpPL2MV/L/O6UKjRYUpQ8 SEJSvTfQWpFSpeBVQnj+m8UlcBaergyXJ78dkusCQ5xENduNgkcmemnYNtR/oh8GZoml 0Qu2dE8Tak/oSgfcudtssqvvsNs5jYYdT0DZI03terEwZe8G8pf2fmbdeEUZK9aSLDno GRYA== X-Gm-Message-State: ABuFfoh9pI9GdZh2Zr+d5JHZEW8Yb7peW5X+3wOgKxFFEATfQkDLVZS0 3AGSzdj3/Y3Ya/dC4sEnRbPayHJ4itKwF2QPwwnIKCbP X-Google-Smtp-Source: ACcGV60rHLYZw6HG5MLz73ayFP/TjwSZ61/1S46I19cNWScpCrBl2ei2RMfPy/gO/GoteTIdNwvDTH2Xg1jf7mLtjDM= X-Received: by 2002:a5e:df04:: with SMTP id f4-v6mr5599432ioq.235.1537360699201; Wed, 19 Sep 2018 05:38:19 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 19 Sep 2018 13:38:07 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000005e232f057638aefa" Subject: Re: [PHP-DEV] [RFC] [VOTE] Typed properties v2 From: rowan.collins@gmail.com (Rowan Collins) --0000000000005e232f057638aefa Content-Type: text/plain; charset="UTF-8" On Tue, 11 Sep 2018 at 08:05, Bob Weinand wrote: > Hey, > > As announced, we are starting the vote on typed properties today. > > The voting period is two weeks, until sometime in the evening on Tuesday > 25-09-2018. > > Please find the RFC at https://wiki.php.net/rfc/typed_properties_v2. > For the record, I still think we will come to regret allowing non-nullable type hints without any constraint on the author of the class to initialise them correctly. As proposed, the invalid state may only be detected when it causes a runtime error in completely unrelated code. I gather that the authors of C# are currently going through a painful development phase to introduce better support for non-nullable types, and having to include many compromises and handle many edge-cases because it was not done earlier. I realise this case is not completely comparable, but we have an opportunity to get this right first time, and not just take the easy option. I am therefore going to make one last plea: if we don't yet know how to assert that complex types are initialised, do not allow them to be non-nullable in the first version of this feature. That is, allow `class Foo { public ?Foo $foo = null; }`, but not `class Foo { public Foo $foo; }`. This would still be a huge improvement to the language, but leaves us free to design additional features to prevent Unitialized Property Errors becoming as hated as Null Pointer Exceptions in Java or C#. Regards, -- Rowan Collins [IMSoP] --0000000000005e232f057638aefa--