Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44773 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80276 invoked from network); 7 Jul 2009 15:14:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jul 2009 15:14:26 -0000 Authentication-Results: pb1.pair.com header.from=ilia@prohost.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ilia@prohost.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain prohost.org from 209.85.219.213 cause and error) X-PHP-List-Original-Sender: ilia@prohost.org X-Host-Fingerprint: 209.85.219.213 mail-ew0-f213.google.com Received: from [209.85.219.213] ([209.85.219.213:39278] helo=mail-ew0-f213.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E9/2D-17523-F46635A4 for ; Tue, 07 Jul 2009 11:14:25 -0400 Received: by ewy9 with SMTP id 9so785939ewy.23 for ; Tue, 07 Jul 2009 08:14:21 -0700 (PDT) Received: by 10.210.42.13 with SMTP id p13mr3658381ebp.8.1246979661041; Tue, 07 Jul 2009 08:14:21 -0700 (PDT) Received: from ?192.168.1.177? (TOROON63-1176059019.sdsl.bell.ca [70.25.60.139]) by mx.google.com with ESMTPS id 7sm1002116eyg.57.2009.07.07.08.14.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 07 Jul 2009 08:14:19 -0700 (PDT) Cc: Christian Schneider , PHP internals Message-ID: <4637B35E-96A2-46AB-AEEB-DE698B9180C3@prohost.org> To: Greg Beaver In-Reply-To: <4A536183.407@chiaraquartet.net> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Tue, 7 Jul 2009 11:14:15 -0400 References: <2D0F5226-EBCA-4B45-BF01-8ED1C643976C@prohost.org> <4A535468.2000606@chiaraquartet.net> <4A535BEF.8060302@cschneid.com> <4A536183.407@chiaraquartet.net> X-Mailer: Apple Mail (2.935.3) Subject: Re: [PHP-DEV] Re: Type hinting/casting request for vote From: ilia@prohost.org (Ilia Alshanetsky) Greg, the T_CLASS fix you've suggested in your e-mail to me could work, but calling a type hint "class" rather then "object" seems a little awkward to me. Plus to your point and earlier Stas' e-mail the patch would reserve the a whole bunch of type based keywords, personally I feel that this is fine, because its seems wrong to call classes by type names, but recognize a fair number of people maybe doing it. I'll take a look at the lexer, but I am not sure there is a simple solution around that. On 7-Jul-09, at 10:53 AM, Greg Beaver wrote: > Christian Schneider wrote: >> Stan Vassilev wrote: >>>> +1 if the object type hint is change to use T_CLASS so we don't >>>> break >>>> every external package using "Object" as a base class. >>>> http://www.google.com/codesearch?as_q=class\s%2Bobject&btnG=Search >>>> + >>>> Code >>>> &hl >>>> = >>>> en >>>> &as_lang >>>> = >>>> php >>>> &as_license_restrict >>>> =i&as_license=&as_package=&as_filename=&as_case= >>> Or this can wait until 6.0, when (as I hear) we'll have case- >>> sensitive >>> class names, so Object/object, Int/int won't cause collisions. >> >> This won't help much because of functions: > > This changes my vote to -1 in any version without a technical fix in > the > patch to avoid this problem. > > There are 2 ways to avoid this problem > > 1) create a patch allowing reserved words as function/class names. > I've > already tried this for a previous reason, and it's difficult to do > without vastly over-complicating the lexer. > > 2) have 1 syntax, T_*_CAST as in function ((int) $a) {} and have that > mean strict type hinting. > > Ilia: if you can include a lexer patch that allows reserved words in > key > places, I'd be willing to modify my vote. The problem is supporting > static class things requires lookahead tokens, thus one would need to > specify that this pseudo-regex is a T_STRING: > > /(LABEL)(?:\s*->|::)/ > > not to mention having a new "looking for label" state that is entered > whenever we encounter class|interface\s+(extends|implements|{) or > T_NEW > > Although having this freedom would be nice, I prefer #2, it's a whole > lot simpler. > > Greg > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >