Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103206 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58444 invoked from network); 20 Sep 2018 19:14:44 -0000 Received: from unknown (HELO mail-qt0-f194.google.com) (209.85.216.194) by pb1.pair.com with SMTP; 20 Sep 2018 19:14:44 -0000 Received: by mail-qt0-f194.google.com with SMTP id o15-v6so8846773qtk.6 for ; Thu, 20 Sep 2018 08:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=El2AOPRrkim7/JzDyVLCWPcJdtxXOwEaivr0CmsS6Lg=; b=R+BKoSBFnlAPAUB3+2aydp9uGECRUX4wNgOvosn3XsBpPAENRrQ2mfMcrI/WbCXJzW KeFVxzBPShic4PaB2Fnf47blCvPgYIEA3GaeTEWMU0PiMeg4mhGGaAKJMCRs+6WH7OX/ xEE4kdCsknASasbmvo/qcSbPjd6BbVKYt75gIDG6MgSP+H9Vh/45oBhA0nkTiRJh624w CXnSEg98XIC5iy3Erd3mbwFf8K8OdcRL/RFeUDfqkTooZt255OrAGVk0hSW13IeO9G8u BaXQvJjRM2mlnD5SJSabGCxYNPDB5Tqm5qTLQBv/kISiMNI0/427M3/Nh4u2ToQoFL+q oM8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=El2AOPRrkim7/JzDyVLCWPcJdtxXOwEaivr0CmsS6Lg=; b=gaQStXLgeVPoH96oNghP7t9z/iLfgQtU98jime7nr/bElJvqaiska4mrGn9Ox4QCAS gp6i3Wgxuu2/2Dr8ke5WqC7K5gwOYVfccCdjSLfOhJTkbBpLr3KpT1jKw4iswBIP0vC3 /3vjK2fyYd9A2YU+6XROoVL+vsTlhCEmKdD2NSKxxvoAmM5Rt9Fi1+Fso0Lt/o/7heAl 0y28nGygqBUZTbtbaiNL5/ggFL+89ihWorjy+HXzJ6CUyh+N7HXd92Gjs+UeJJqgT93y izB+vm3/l2qiKFl2KOwzuOZXZXZ2OLt8dSq4OqmEJGgP2mUGoKOGCSfooikIWGL5qkET HvEg== X-Gm-Message-State: APzg51CfzWju0Ow/ZsMoB/j/UZ3WcuRMLSh1GoaKMoW1Ou6gFmzpBAdz MZ/OHfX/fM7dZvw17TOfwClioO1vU9HR3RxUVHnjjA== X-Google-Smtp-Source: ANB0Vdb+Te2Cz+ODzaFwTdfMYY9eoLh2AOCWzLjb4GvqaesihpotAR/gK7sChjTJxUswL3HCWrTi3sgiaEODwH99OC8= X-Received: by 2002:a0c:885b:: with SMTP id 27-v6mr28665183qvm.115.1537456882562; Thu, 20 Sep 2018 08:21:22 -0700 (PDT) MIME-Version: 1.0 Sender: php@golemon.com Received: by 2002:a0c:f00e:0:0:0:0:0 with HTTP; Thu, 20 Sep 2018 08:21:21 -0700 (PDT) X-Originating-IP: [98.213.160.75] In-Reply-To: References: Date: Thu, 20 Sep 2018 10:21:21 -0500 X-Google-Sender-Auth: u78KCob-HcwhXMu9ZWgKiEQCsQk Message-ID: To: Levi Morrison Cc: Rasmus Schultz , Rowan Collins , internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] [VOTE] Typed properties v2 From: pollita@php.net (Sara Golemon) On Thu, Sep 20, 2018 at 9:50 AM, Levi Morrison wrote: > This will be my last reply to this thread. > This will be my first and, God willing, only reply to this thread. > Fundamentally: > > class User { > public int $id; > public string $preferred_name; > public string $username; > } > > ^ This never permits null properties, and using them without > initializing them is an error, and you get notified by the runtime > that such a thing happened. This is good and desirable behavior. > This is bad and undesirable behavior. Deferring the error to on-read makes the properties magic and unknowable. This is broken by design. The RFC got my vote because broken never stood in PHP's way, and at the very least, as a library author, I am empowered to aggressively initialize my properties even if the runtime gives me insufficient protections from coding errors. A static analysis engine can pick up the slack where the engine falls short, so that's my yes vote, but it's not an endorsement of the fundamentally broken design. -Sara