Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102848 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85545 invoked from network); 16 Jul 2018 12:01:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2018 12:01:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=danack@basereality.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=danack@basereality.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain basereality.com from 209.85.160.54 cause and error) X-PHP-List-Original-Sender: danack@basereality.com X-Host-Fingerprint: 209.85.160.54 mail-pl0-f54.google.com Received: from [209.85.160.54] ([209.85.160.54:35099] helo=mail-pl0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/4A-39793-CF88C4B5 for ; Mon, 16 Jul 2018 08:01:01 -0400 Received: by mail-pl0-f54.google.com with SMTP id w3-v6so2032074plq.2 for ; Mon, 16 Jul 2018 05:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KOs+XDhI9pEq4DVVE/wOT/JvzVrfqogxFeUW+ULo8CM=; b=E+IH//pr3k2VANuqn5keLKE0yuITnPr5IaJg5CB13F1H7iatXS0cRqR4SarCWzvtHn 9hYTAWrAzj6kKjwBBHMB3Hs0rmUWzMwEp6WIMhjEQNsH4KwbXXw/siIbEZ53BoC0hDrh p7zsE/ZlcMOV+ruqwjJKVX2sHkpP1dYIN03J2PNuPARqow9cydqma6qJsf2coNfkQlbC rEhvde1sEci5EpWDxubmc+uw4LIdPw2XdAWJeWgl5d4HEAeaNaJsFmGANDE9drmJzpCn G01qr3vqPtji8rX2Kkk1MfVNiGVQfSBLwGPiuoWJHo7Sj80Ks70gG3v8fqc+erQfnuMF I8tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KOs+XDhI9pEq4DVVE/wOT/JvzVrfqogxFeUW+ULo8CM=; b=bpsDBRKTPBTRVwYr01PUVsqKUoU8XAuWQPHuskfiVNCwwUtatgewvN6ZUfNQhOiqpO rufkPivJjlO/u4vmjk4WYj3++xIF4oKLFXyp46motdMDXitO41GIPefANKhcISRfX60J 3DY32+Q1vagTNylEd4QEqf+MDzndr1WDeIdna+v0D2zIQhwXLue52hKTI2IOlFtWyWLV 1rxAX0b6EIl12Y6PICft8XUdAzyhfxhMmHC3bEBVZG032xYPYOYOgbwPk7+rxx9DT/zr 1mPo31w6xxcHiPsLTOJ+ln1eCuyc7KQEPW16muMZwItjkKSuFHPHZbxb5gBvQekwfsHy mXhQ== X-Gm-Message-State: AOUpUlHujgCVnIMx0sRcz3lpdEGHWAq2A1cLfjaslNO3jVW7aGoZ1Yw7 KDN+uI7oWSERZU+q3aVuHihvC3zqBDB6aej5w+xV8w== X-Google-Smtp-Source: AAOMgpdkukVb6CIOeAby1XcJF4GUG5JE71cUSEQ4zy5oFWgRHWHfqK9jLf198hlSKBvjfiBq2HUP1k8/YsolNw9OR+w= X-Received: by 2002:a17:902:722:: with SMTP id 31-v6mr16767908pli.3.1531742457917; Mon, 16 Jul 2018 05:00:57 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:87:0:0:0:0 with HTTP; Mon, 16 Jul 2018 05:00:57 -0700 (PDT) X-Originating-IP: [78.145.253.203] In-Reply-To: <0AA3251E-A0D8-492E-AEAC-3B2FBBFDB944@gmail.com> References: <8916EC21-D368-40F8-9ABD-CE0C04A73539@gmail.com> <0AA3251E-A0D8-492E-AEAC-3B2FBBFDB944@gmail.com> Date: Mon, 16 Jul 2018 13:00:57 +0100 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Non-nullable properties From: danack@basereality.com (Dan Ackroyd) On 16 July 2018 at 09:43, Rowan Collins wrote: > There's no contradiction here; throwing an error when a > property is *read* is not the same as enforcing that it always has a valid value. That's true, but claiming the RFC just 'trusts' the users to initialise them is a miss-representation of the RFC to me. The RFC catches the mistake if the programmer fails to initialise the variable then reads from it. > If not, the object created would not be fully initialised, This is always going to be the case, unless you're proposing to deprecate ReflectionClass::newInstanceWithoutConstructor .... which is going to break a huge number of applications. tbh, I really don't see a real problem that needs to be fixed. For me it is the equivalent of this: function foo() : int { return "five"; } This gives an error when the code is run, not when the code is compiled, despite it being a 'detectable' error. In most compiled languages, this error would be detected at the compilation step. In 'dynamic' languages it is detected at run-time. The same is true for classes with typed properties. Yes, if you make a mistake and forget to set a typed property before using an object there will be an error. That would only be a problem in production if you don't run that code at all in development or in test....which is true of many, many things. cheers Dan