Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93550 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98457 invoked from network); 26 May 2016 07:32:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2016 07:32:50 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.218 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.218 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.218] ([81.169.146.218:13221] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 37/55-14311-1A6A6475 for ; Thu, 26 May 2016 03:32:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1464247966; l=4454; s=domk; d=kelunik.com; h=Content-Type:Cc:To:From:Subject:Date:References:In-Reply-To: MIME-Version; bh=KH48jy7GaSm64ukZuHSu0+zatComvO6M7pVruWU+4Pk=; b=NobBuGc1SsZjOKCb0X3dt7MvP8/y0T5sP+alwAKgu1riyArPUdSCU4svy82AWgQYyLx d5fdMg8iZP45HPRZjnfuEqkGhpdn1QiioCxoHLEmQR085+WrGiRPNzR0WMgDPxOsHQ2F/ h1azhXyhtv752R5WU7UuGkCLr+os+/IjgPU= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLGvomb4bl9EfHtO3I6 X-RZG-CLASS-ID: mo00 Received: from mail-wm0-f41.google.com ([74.125.82.41]) by smtp.strato.de (RZmta 37.27 AUTH) with ESMTPSA id j0790cs4Q7Wk218 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp384r1 with 384 ECDH bits, eq. 7680 bits RSA)) (Client did not present a certificate) for ; Thu, 26 May 2016 09:32:46 +0200 (CEST) Received: by mail-wm0-f41.google.com with SMTP id z87so87860673wmh.0 for ; Thu, 26 May 2016 00:32:46 -0700 (PDT) X-Gm-Message-State: ALyK8tKEgjt9ArPOc0VM8E91Fue8v+oCwmeQXJj7pxOyMUIR0AumG88gMqoas2ykZXsmKmYcT+ZkAgc1KkXSDA== MIME-Version: 1.0 X-Received: by 10.28.93.6 with SMTP id r6mr2179451wmb.93.1464247966149; Thu, 26 May 2016 00:32:46 -0700 (PDT) Received: by 10.28.53.132 with HTTP; Thu, 26 May 2016 00:32:45 -0700 (PDT) In-Reply-To: <53274ca9-98a5-ca46-94ac-57b2c61885d4@gmail.com> References: <7B.12.14311.F79C5475@pb1.pair.com> <1b12b09f-f190-dca0-51d9-468e9c571268@fleshgrinder.com> <20160525213546.D7EE41A801B3@dd1730.kasserver.com> <53274ca9-98a5-ca46-94ac-57b2c61885d4@gmail.com> Date: Thu, 26 May 2016 09:32:45 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Stanislav Malyshev Cc: Bob Weinand , Thomas Bley , Andrea Faulds , PHP Internals , ocramius@gmail.com, Benoit Schildknecht Content-Type: multipart/alternative; boundary=001a114690d8e2d2280533b9cbcd Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: me@kelunik.com (Niklas Keller) --001a114690d8e2d2280533b9cbcd Content-Type: text/plain; charset=UTF-8 2016-05-26 7:00 GMT+02:00 Stanislav Malyshev : > Hi! > > > Also, property access never was safe. Consider: > > > > $obj = new class { > > public $foo; > > function __construct() { > > unset($this->foo); > > } > > function __get($prop) { > > throw new Exception("No $prop for you today!"); > > } > > }; > > var_dump($obj->foo); // exception. > > This is different. Your code throws exception purposefully so you intend > something to break here - you might as well just written exit(1) and > said there's no safe code at all since you could exit at any moment. > That's not what I mean. I mean that operation that was previously not > prone to fatal errors just because of variable holding some value would > now produce such errors - not because the user wrote code to > specifically do that but because of hidden properties of the engine. If > the engine would by itself insert such code as above into user classes > that would be dangerous too but of course it does not. > > > > > isset() checks will continue to work. > > For some definition of "work" - since it would return false for null > values, but null values are actually OK. If there's a function to check it, how would you handle it? It's clearly a programming mistake. > It's just about getting a *value*. (and to check whether it's a typed > property, there's Reflection support in the RFC.) > > You don't propose using Reflection before each variable access I > presume. Reflection is useless in runtime scenario. > > -- > Stas Malyshev > smalyshev@gmail.com > --001a114690d8e2d2280533b9cbcd--