Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60070 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73148 invoked from network); 17 Apr 2012 11:19:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2012 11:19:07 -0000 Authentication-Results: pb1.pair.com smtp.mail=ralph@ralphschindler.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ralph@ralphschindler.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ralphschindler.com from 209.85.214.170 cause and error) X-PHP-List-Original-Sender: ralph@ralphschindler.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:42129] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/70-03996-5A15D8F4 for ; Tue, 17 Apr 2012 07:19:01 -0400 Received: by obbup16 with SMTP id up16so1485838obb.29 for ; Tue, 17 Apr 2012 04:18:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=w+px6dKWthwF0J++Rzba4NtDpt0VJ2yQNydmlO4LsOk=; b=Vj1KoFGAQIMVhueFoEjw9EH1G1IDtV82v0zDegrnjhOB9YEMTG1ryvK34ZuBunKKGD uG2bjXIWeZZFvPmVAHzmunQr9dvdjne4BXPrM3zlE2NqWito29FwDsreH4XSzrdDx55T bPYochj9vZR12zXFOoWZDaWLEq96zNBoGW0Vzz2f2iBzsCFRWzjnjqjke3IBSL9Gt4Ia BMZu0JCmXovPY/xpkdHJQLfjYqqMRGgYgyTSAL6sosAyrDIw2IUb+Kjo7gdU5hL7a6qF 06LrcO9PIqGhreB/3veLi+Pik+BSrLSLTP5sX5ExdHto+0RrH9SP0j4wEPwuZYDmHKAV tZ+Q== Received: by 10.182.72.71 with SMTP id b7mr21032916obv.11.1334661538719; Tue, 17 Apr 2012 04:18:58 -0700 (PDT) Received: from ralph-mac.local (ip174-73-14-247.no.no.cox.net. [174.73.14.247]) by mx.google.com with ESMTPS id b2sm22717128obo.22.2012.04.17.04.18.57 (version=SSLv3 cipher=OTHER); Tue, 17 Apr 2012 04:18:57 -0700 (PDT) Message-ID: <4F8D51A0.5070605@ralphschindler.com> Date: Tue, 17 Apr 2012 06:18:56 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: Nicolas Grekas CC: internals@lists.php.net References: <4F89D4F1.8070009@ralphschindler.com> <4F8CEB3B.4080702@ralphschindler.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQkqno9KioCWLJltJ4JpGKe0P6ywZk690mIn9cD9cn+U8WXQK+B7DPDhbvI3qk6WPY+4lHfR Subject: Re: [PHP-DEV] Re: New Feature: Fully qualified class name resolution as scalar with class keyword From: ralph@ralphschindler.com (Ralph Schindler) > May I suggest using foo::__CLASS__ instead of foo::class ? It's longer, > but closer to what already exists for this semantic (class name as > string), don't you think ? > As Marco suggested, I think using __CLASS__ would be confusing to some. __CLASS__ generally means, "where you see this, replace it with the class you are in right now". I generally don't like to draw comparisons too closely to Java and .NET, but Java has this, they call it a "class literal", which works the same way as described in my new feature: http://stackoverflow.com/questions/2160788/what-is-a-class-literal-in-java In .net, if a type is a SystemType.Type object (which I think are all types), you can simply call a function on it to get the name: http://msdn.microsoft.com/en-us/library/9f49ew66.aspx In addition, I am unsure if there would be any BC issues with your proposed syntax. I do know with mine (::class) does not pose any BC issues since the class keyword was limited to declaring a class only. At least, the tests prove this, and I can't find any other usages of T_CLASS in the parser. > Personnaly, I would say that an RFC would be good for historical > reference and documentation. I think you're right, I'll do this today. -ralph