Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102854 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6436 invoked from network); 16 Jul 2018 15:59:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2018 15:59:30 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.51 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.214.51 mail-it0-f51.google.com Received: from [209.85.214.51] ([209.85.214.51:40871] helo=mail-it0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/5D-39793-1E0CC4B5 for ; Mon, 16 Jul 2018 11:59:29 -0400 Received: by mail-it0-f51.google.com with SMTP id 188-v6so22074587ita.5 for ; Mon, 16 Jul 2018 08:59:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=PlIwyjPHYcauPKW6mbUDZMUVcpK5SiqkHxe+PBe+lwc=; b=riE0cvSHxBaK1wQIOGcKdeMBC8X7wFHDyig46++hK5LzDQI/c79G4XmI/OjKd61YOK J6R7suInqBJj5V71k3WcSN32BlovGq1WOvxIi5bguy0SLLXsdZ6t7GEViE+M8nTUDMat oUMVe4QObl/93ulQzdR7DAXNvbSbfhJqBKCEkBLsUDi7Nq3p/zS2wbqD6KTJfa0R/qfp bpeBMDSHkPlpjFkM++Gc6SICfKyu3XS8fjFIvNL+M8yH8A5h7JagyYbTJXpb+o7CCZaW BtrsP4yG/Haf3iF/J4WVwDk7TzjN4+x0S03OdL2nGHvSaChQWQruZdc0QbdDtMf6R/wX AxLQ== 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=PlIwyjPHYcauPKW6mbUDZMUVcpK5SiqkHxe+PBe+lwc=; b=lXFa6mSdwdxpATfVY+7dPXlNo3tQuQqj9fJ926DsCkbtsP1SK5ToytYolqVNeT7SHG R2zLsIdAXHqJjXu4l6pMzlE48o97xIQZwFXT4Uj5XUr7anvllPNrT3qyJLIGWBaoraMO YXHP4OTAmJ+rc1UzyYhx93K9+zTwUaUWUXgoroq87gdSOR9HB3skXbuloAbZmJ4VwAj1 X+OPmQ6kqhDRGf2isRun4vm2bXTBlOCgnUeoW4sGGld2D446MO2PQlHbL4N8m7aj6YMb QEvEXlfbB0yDQDtX3mJMEMxRMrL6ak5uUnAjOjaBxhS4rwsLcaa9rQE71Ele+knUCKAI R82Q== X-Gm-Message-State: AOUpUlF/07/r3CFfzsyXidAl/XGkV6PCWD9fkxbkp8vVZAPopIAIL2tl R2d9/dgmq05gglWzi0kPXrCBVu8zLR9lUr8zpHA= X-Google-Smtp-Source: AAOMgpf9KxKBBRhlRge06pTOVcAYjV6u/wJnzXsKSOC+lZkkEvHnZF0oDAtOazBrrzPYANhyHoXvXgYCNnOVyLTP6XU= X-Received: by 2002:a24:fe44:: with SMTP id w65-v6mr13786232ith.33.1531756766436; Mon, 16 Jul 2018 08:59:26 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:95a8:0:0:0:0:0 with HTTP; Mon, 16 Jul 2018 08:59:25 -0700 (PDT) In-Reply-To: References: <8916EC21-D368-40F8-9ABD-CE0C04A73539@gmail.com> <0AA3251E-A0D8-492E-AEAC-3B2FBBFDB944@gmail.com> Date: Mon, 16 Jul 2018 16:59:25 +0100 Message-ID: To: Marco Pivetta Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000f2214f05711fe9b5" Subject: Re: [PHP-DEV] Non-nullable properties From: rowan.collins@gmail.com (Rowan Collins) --000000000000f2214f05711fe9b5 Content-Type: text/plain; charset="UTF-8" On 16 July 2018 at 16:42, Marco Pivetta wrote: > There are naturally 3 states in the engine: > > 1 - value set > 2 - value not set (default `null`) > 3 - undefined/uninitialised > > These have been around since 5.0 AFAIK. > "Undefined" and "uninitialised" are not the same state: class A { public $alpha = 42; public $beta; // no such property as $charlie; public SomeClass $delta; } $a = new A; $a->alpha; // value set $a->beta; // value not set (default null) $a->charlie; // undefined, but still accessible, with implicit value null $a->delta; // uninitialised; all attempts to access will throw an error The behaviour of $a->charlie is consistent with other undefined variables (e.g. a local variable can be read before it is written to). I can't think of anything in the language which behaves the same way as $a->delta. Regards, -- Rowan Collins [IMSoP] --000000000000f2214f05711fe9b5--