Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93553 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13744 invoked from network); 26 May 2016 09:46:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2016 09:46:27 -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 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.44 mail-wm0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:35839] helo=mail-wm0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 88/28-14311-2F5C6475 for ; Thu, 26 May 2016 05:46:27 -0400 Received: by mail-wm0-f44.google.com with SMTP id a136so18156584wme.0 for ; Thu, 26 May 2016 02:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=Aff+qoA+cdQv7v+TDU28Lpo6ksv75bVNeoDKyTLhqa8=; b=d8cFFN7gf+la0a610rSWGCB1LDOA8MYUFCikdahnzKhPhoVobE29azrrvojzbiR6m+ 2guixBC8rODmwIrzHhYLfNpDnDfLQMvOc5dUxq4N8Rx/89cWs2hiHv7iGqLXTqEQDD5h gdcjYRxnjy3yiGvUsHqvQZgWoqpfgAj6PidwY45Bms3QwAilYjzADfinLACWBxFn72gW Ku7UsHp1ix31BI416kbxDCXSebXnYxpg/pwgrzz+x8C1cBXoMizeHTf5BG+33wSdN/Pj 7OnrarcJQghrZLy3lCbEG2tcIX8fgZqLXM585Tsm2DJiq7ldIepzTA4Dhzp79wEy5GcD X+sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Aff+qoA+cdQv7v+TDU28Lpo6ksv75bVNeoDKyTLhqa8=; b=F1qiSAnXKtgCqQrs+pavPRXw/p9697lpqvBVO3hxIggZ55fO4+rJUwaxjkWAeihdcz zn6/Nf3NOlVAdje1kDEvfdRIDY3oNCZjmXur6BPW75+rIYJQwMl7S4S/COmVFtxBXApt trumhxNpwTm4fkCioaIoT3SK8PaPqggpIWP/GjVAJuNkXyL74H4Yq2soQjP0mW0JV4rW WuT/Z5DadEK3Si8z/oCQyq5M9e9umsZGCKAXhbfeSvcPtSzk860dZJ7qw4PHFPNvC1O5 ecPIp2ctdsoHNm8DlRTifmFXCq0KIyV+/ux/70qkPhs8YQwwVPTrs/0F1DDABChW6Je4 IVuQ== X-Gm-Message-State: ALyK8tJ37h+llUgfvqgDQtKl31zMvwzIPrYZPvjcLKOGQuBNGkw6JYXrls/GNG9k+c5+OA== X-Received: by 10.194.105.4 with SMTP id gi4mr8804111wjb.87.1464255983324; Thu, 26 May 2016 02:46:23 -0700 (PDT) Received: from [192.168.0.98] ([93.188.182.58]) by smtp.gmail.com with ESMTPSA id kq9sm13401234wjc.26.2016.05.26.02.46.22 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 May 2016 02:46:22 -0700 (PDT) To: internals@lists.php.net References: <7B.12.14311.F79C5475@pb1.pair.com> <1b12b09f-f190-dca0-51d9-468e9c571268@fleshgrinder.com> Message-ID: Date: Thu, 26 May 2016 10:44:40 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <1b12b09f-f190-dca0-51d9-468e9c571268@fleshgrinder.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: rowan.collins@gmail.com (Rowan Collins) On 25/05/2016 22:03, Fleshgrinder wrote: > We already have the differentiation between IS_NULL and IS_UNDEF, why > not expose the latter to userland? I wondered if the conversation would go in this direction. This has been discussed to death, and in my opinion all the reasons given in previous discussions why isset() is not broken, and we do not need a new magic value / type, are just as valid in the case of object properties as anywhere else. I can see an advantage to this raising some kind of warning: class A { ?int $foo } $a = new A; var_dump($a->foo); // not initialized yet! But it should absolutely not be possible to detect the difference between that and this: class A { ?int $foo } $a = new A; $->foo = null; var_dump($a->foo); // null Because that is exactly the same as this: var_dump($foo); // not initialized yet! vs this: $foo = null; var_dump($foo); The warning or error on unitialized variables or properties is an assertion - code should be written such that it simply *can't* happen. If you're unsure if something's set, you can always do this: if ( ! isset($this->foo) ) { $this->foo = null; } If it's already an explicit null, you perform one unnecessary operation; if it's never been initialized, it has now. Regards, -- Rowan Collins [IMSoP]