Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91764 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99752 invoked from network); 19 Mar 2016 09:17:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Mar 2016 09:17:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=leedavis81@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=leedavis81@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: leedavis81@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wm0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:38242] helo=mail-wm0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 25/E3-03097-2391DE65 for ; Sat, 19 Mar 2016 04:17:39 -0500 Received: by mail-wm0-f54.google.com with SMTP id l68so66262464wml.1 for ; Sat, 19 Mar 2016 02:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=w8w8T7RKaZspe4pBqBzgp+S1arolg2xGMkjH3UCyfHs=; b=crgmRaP3SsRGuiAiKpQcQdRea1vWWNzKkZjZT2A2kzrrLqUHePEH+tDsbM4QC4zhbu NgdFOkkwEwcoLJFGUrx08iwiGiQcs1wfrPZ0ysdHGSkmBopQaareL2uYM9ZX/YpuxBvz DKWVJQ5+8vZitdifvtiiP8STEBefBWeVU+UiF257uA1OoxWvDKjKfJ/Fy7FyMo8P4Kk1 gXzMfsPGTZxSSsoFO1Fw/oRL9qhTarYJPCyBxRhwi3waUQWiUFymi1zfn07Bz4ZK+jq5 GSs1D+c0kKZlJs5peBnV2i5HkHWLqu4C5gRB+FNMVshYkj6EBV5wGz7PYpAoTiZ4L+JB SvWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=w8w8T7RKaZspe4pBqBzgp+S1arolg2xGMkjH3UCyfHs=; b=SCycu7RQKSeSYkanDlPSNCkyVxI+HWwIL94cpSw8aiRaXCPFtQnhcAzzxiId2d+1Ss aTOY0btEpRfda4lI9W6EUYhu++wElCQYuYgfLJRrlNL4P55/9FA19fWd1rjdG8GC6JQy lKp1BPtOzbp4kdFTLTJTlsdN4h9PvSFiJ8fRtIm3aDmJEs6phX1NNRADpyHOQvLoN7Qt v69+cLQcXu7TsoHdBmwkMU/CZ+b3IubfiK2buAIukE1PbMKO6UdJvB3mCduWC4H+RtZw x7wShZXz4aSjBcsRCIOZTZe6IyYfNaYKxYKSyfO2EScayfp6lEovLPMquoezqcB/17sg sJ4g== X-Gm-Message-State: AD7BkJK/gBQvF9jSsxLHk7a/PuiE47KvAhgy3ETTImp0s8FNXxN43tqo075+fpn9pLwuqDcrhmvu1jEK7wg20A== MIME-Version: 1.0 X-Received: by 10.28.225.198 with SMTP id y189mr3637667wmg.94.1458379056063; Sat, 19 Mar 2016 02:17:36 -0700 (PDT) Received: by 10.28.222.3 with HTTP; Sat, 19 Mar 2016 02:17:35 -0700 (PDT) In-Reply-To: References: Date: Sat, 19 Mar 2016 09:17:35 +0000 Message-ID: To: Joe Watkins Cc: Phil Sturgeon , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a114b0c8895a95c052e6355c2 Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties From: leedavis81@gmail.com (Lee Davis) --001a114b0c8895a95c052e6355c2 Content-Type: text/plain; charset=UTF-8 Hi Joe, > Accessing the property before it was unset though, as it always did, > attempts to read the default value (null). > > We haven't changed any of that ... > Yes, you're right, this is exactly how it currently behaves : https://3v4l.org/YpfYe (apologies for not checking this first). Still seems inconsistent, but that's now outside the scope of the RFC. > The most you can say about this, is that it's strange that the same > exception is raised for both cases, which we're aware of; Right now, it's > impossible to distinguish between the two states. > Makes sense. AccessTypeError, WriteTypeError to both extend TypeError? > > The things you can be sure of: > > - If you get a value from an access of a typed property, it is the > correct type. > - If you get exceptions, you have logical errors in your code. > Perfect. I'd still prefer the TypeError to only occur on setting rather than on access as well (along with a fair amount of others: https://twitter.com/leedavis81/status/710872866556874753), this would then have the RFC only concerned itself with the WHAT rather than the WHEN, but as long as that promise can be upheld then it's a great feature to have. I think adding in rules at the language level to dictate when it should be set (i.e after construct) is a bad move, so I'd be in favour of leaving it as it stands at the moment. Property accessors could solve the problem of uninitialised properties later on. Cheers for all your hard work guys, Lee /@leedavis81 --001a114b0c8895a95c052e6355c2--