Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53914 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45661 invoked from network); 12 Jul 2011 10:07:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jul 2011 10:07:46 -0000 Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 87.106.212.190 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 87.106.212.190 s15355703.onlinehome-server.info Linux 2.6 Received: from [87.106.212.190] ([87.106.212.190:33504] helo=s15355703.onlinehome-server.info) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/D3-07173-FEC1C1E4 for ; Tue, 12 Jul 2011 06:07:44 -0400 Received: from hwhost.local (85-218-19-237.dclient.lsne.ch [85.218.19.237]) by s15355703.onlinehome-server.info (Postfix) with ESMTPA id 97583E413B; Tue, 12 Jul 2011 12:07:40 +0200 (CEST) Message-ID: <4E1C1CEC.2050802@hoa-project.net> Date: Tue, 12 Jul 2011 12:07:40 +0200 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Pierre Joye CC: Patrick ALLAERT , Stas Malyshev , PHP Internals References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Make primitive type names reserved words (Was: Re: [PHP-DEV] [RFC] 5.4 features for vote (long)) From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") On 12/07/11 11:09, Pierre Joye wrote: > hi, Hi, > As of now I do not think we should allow this change, whether the RFC > is accepted or not does not matter as it will badly break BC. Unless > there is a patch allowing this change without affecting existing code > (main point being namespaced code working smoothly), this RFC should > be rejected. With these new elements, I agree the fact that the RFC should be=20 rejected. But maybe we can add new magic methods, such as: __toBool(),=20 __toInt(), __toFloat() etc. User can use int(), float() etc. if he=20 needs/wants to, and we are always able to do same things (e.g. adding=20 future features). Moreover, PHP has a dynamic typing system. Having tokens as reserved=20 keywords appears obviously logical to me, but why having type names as=20 reserved keywords? Sounds like we do not assume our =93type position=94. = That's why adding magic methods looks like a better way to solve this=20 problem. Thougs? Best regards. PS: I cannot change my vote on https://wiki.php.net/todo/php54/vote, is=20 it a known issue? > On Sun, Jul 10, 2011 at 6:41 PM, Patrick ALLAERT wrote: >> 2011/6/17 Stas Malyshev: >> >> [snip] >> >>> 2. Make primitive type names reserved words (in case we ever want som= e form >>> of scalar typing or anything else with scalar types). Using them as >>> identifiers would return parse error for now. May have BC implication= s. >> I am not sure it is a good idea to make them reserved words without a >> clear reason for doing so. >> >> I'm sure some projects have defined classes with those keywords in >> some namespace (to ensure they wouldn't conflict with possible PHP >> built-in stuff) like in: >> >> namespace \Types { >> class Int { >> // ... >> } >> class Float { >> // ... >> } >> class String { >> // ... >> } >> // ... >> } >> >> Developer may have taken care of defining them in a specific >> namespace, would it be possible to not break their application while >> making them reserved keywords in the global namespace only? >> >> I would be +1 if this could be done for the global namespace only. >> However, -1 if this would break the usage of classes like \Types\Int, >> \Types\String, ... would break. >> >> Please, rethink your vote taking this into account. I don't think it >> is required to hurry up on that decision while we still don't have a >> *clear* proposition for scalar type hinting. >> >> Cheers, >> Patrick >> >> [snip] >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > --=20 Ivan Enderlin Developer of Hoa Framework http://hoa.42/ or http://hoa-project.net/ Member of HTML and WebApps Working Group of W3C http://w3.org/