Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64523 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12096 invoked from network); 4 Jan 2013 15:19:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jan 2013 15:19:02 -0000 Authentication-Results: pb1.pair.com header.from=cpriest@zerocue.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cpriest@zerocue.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zerocue.com designates 67.200.53.250 as permitted sender) X-PHP-List-Original-Sender: cpriest@zerocue.com X-Host-Fingerprint: 67.200.53.250 mail.zerocue.com Received: from [67.200.53.250] ([67.200.53.250:42530] helo=mail.zerocue.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D1/A0-00128-5E2F6E05 for ; Fri, 04 Jan 2013 10:19:01 -0500 Received: from [172.16.10.217] (unknown [97.79.213.78]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.zerocue.com (Postfix) with ESMTPSA id 261B712034E; Fri, 4 Jan 2013 15:18:58 +0000 (UTC) Message-ID: <50E6F2EB.20108@zerocue.com> Date: Fri, 04 Jan 2013 09:19:07 -0600 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Levi Morrison CC: Nikita Popov , PHP internals References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------050208080404090608030208" Subject: Re: [PHP-DEV] [RFC] Alternative typehinting syntax for accessors From: cpriest@zerocue.com (Clint Priest) --------------050208080404090608030208 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit This shouldn't be an issue because it is not possible to set the property without going through the setter, which would be a type hinted accessor function. Ergo, an attempt to set the value to an invalid value would cause a fatal error and thus the setter would not be able to then set it to the invalid value. On 1/4/2013 9:15 AM, Levi Morrison wrote: > This proposal looks really good to me. It cuts out a lot of syntax and > boilerplate for a commonly used case. However, there is one issue that > I know somebody is going to raise: > > Argument: If you change the value of the property without using the > setter then `get` could return something that has a type mismatch with > the type-hint. > > If I understand the current RFC for properties correctly, the only > place that a property can be directly written to without the accessor > is inside of the `__setProperty` method. This almost nullifies the > argument completely. > > The only other place for possible error would be assigning a value in > the constructor that does not match the type-hint. However, because > we adding a new syntax we *could* disallow assigning a value if it > really was that problematic. I do not personally feel that would be > necessary. > > I feel that this argument is not weighty enough to stop the proposal > for this improved syntax. > -- -Clint --------------050208080404090608030208--