Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65055 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76985 invoked from network); 21 Jan 2013 18:54:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jan 2013 18:54:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:38525] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 40/70-08138-ECE8DF05 for ; Mon, 21 Jan 2013 13:54:07 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id DAD9B700049A; Mon, 21 Jan 2013 18:54:03 +0000 (WET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id 9B0h0QmyioDs; Mon, 21 Jan 2013 18:54:03 +0000 (WET) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 7D2E37000488; Mon, 21 Jan 2013 18:54:03 +0000 (WET) Received: from damnation.nl.lo.geleia.net (a80-101-138-144.adsl.xs4all.nl [80.101.138.144]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 31A3B20071A7; Mon, 21 Jan 2013 18:54:03 +0000 (WET) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "PHP internals" , "Nikita Popov" References: Date: Mon, 21 Jan 2013 19:54:01 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Message-ID: In-Reply-To: User-Agent: Opera Mail/12.12 (Linux) Subject: Re: [PHP-DEV] [VOTE] Alternative typehinting syntax for accessors From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Mon, 21 Jan 2013 19:03:09 +0100, Nikita Popov wrote: > I've opened the vote on the proposal for the alternative accessor > typehinting syntax: > > https://wiki.php.net/rfc/propertygetsetsyntax-alternative-typehinting-syntax#voting > > The vote is done under the assumption that the main accessors RFC will > pass. If it does not, then this proposal is no longer relevant. > I've voted "No" due to concerns I mentioned in most part in IRC, but which I think should be here on the record. So my voting statement: I'm voting against this proposal because I think the proposed syntax strongly suggests that the property is bound to a specific type. This has several problems: * It's a promise that's not guaranteed. As long as the getter is allowed to reference the value of the variable can arbitrarily be changed to whatever type. It may also be possible to do the same with unserialization. * The benefits are minimal. The only real benefit is cutting maybe two lines of code in an indisputably common scenario. * The idea of bounding a variable to a type, even if it worked with no loop holes, should be examined with much more care than this. We have nothing analogous already. It's a misleading argument to say this is just a syntactic sugar (technically it is), because it carries a strong psychological implication by analogy with other languages like Java. And of course, it it had no loopholes, it would mean that we would have gone to great lengths to force the property to be of a certain type, and then we would not be able to claim it was just a syntactic sugar. So the feature is either broken or it's not just syntactic sugar. * And yes, next we'll start discussing extending this to other variables. Yes, this is a slippery slope argument. Slippery slopes are a real phenomenon. People interested in this topic can read this reference [1]. [1] https://www.law.ucla.edu/volokh/slippery.pdf -- Gustavo Lopes