Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60188 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63366 invoked from network); 18 Apr 2012 13:01:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2012 13:01:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@googlemail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:40862] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/4B-03614-83BBE8F4 for ; Wed, 18 Apr 2012 09:01:45 -0400 Received: by lbbgh12 with SMTP id gh12so445951lbb.29 for ; Wed, 18 Apr 2012 06:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=n6bXcn+ZJuWCSp6oV2WTFAUw2964wHLAVo/N6jj+yxE=; b=oRoCiSMwgrg5vvFW/euMrpyZio2IoVgmUBmy+IRDJ2YHQSIz2YyQ/c/udxhxMPXjv5 x9Si38aFKKcEdrZe5fwSZX+FCdmn6N0QJbkEzKdGS2e7WE3uoYJtrqCVRcMEcmy+hi0/ BdmUSA2Jlyin+q9ZF6Z1sfbhk/yR5CiRkC+ROYgK789vdPtx+8gI3YUydPvov/ZuE9cw 2qjdvvIodRFPMHU8fZ7yExUJ2OL8eL3U+M+mVyzxDX8T+WlCwN9ThQCN1MHxtOvJzuro IP/tkAQhfkCITpcBLy4yt7244PH2dZ4ejvmIJjm3a5jyyAy0FyLdcRi7oamG1gXzHvjq Teng== MIME-Version: 1.0 Received: by 10.152.112.161 with SMTP id ir1mr2055037lab.13.1334754101683; Wed, 18 Apr 2012 06:01:41 -0700 (PDT) Received: by 10.152.127.68 with HTTP; Wed, 18 Apr 2012 06:01:41 -0700 (PDT) In-Reply-To: <4F8DFB17.7030509@sugarcrm.com> References: <4F89D4F1.8070009@ralphschindler.com> <4F8CEB3B.4080702@ralphschindler.com> <4F8DA14F.1030204@sugarcrm.com> <4F8DCAC7.2050302@ralphschindler.com> <4F8DF2B6.4030709@sugarcrm.com> <4F8DFB17.7030509@sugarcrm.com> Date: Wed, 18 Apr 2012 15:01:41 +0200 Message-ID: To: Stas Malyshev Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Re: New Feature: Fully qualified class name resolution as scalar with class keyword From: nikita.ppv@googlemail.com (Nikita Popov) On Wed, Apr 18, 2012 at 1:21 AM, Stas Malyshev wrote: > Hi! > >> Well, not that you mention it, I don't see a reason why we shouldn't >> add run-time resolution where necessary. For once this would allow > > Runtime resolution of what? We already have get_class(), > get_called_class() and __NAMESPACE__. Now, having constant expression > for full class name might be useful since some contexts allow only > constant expressions. But for runtime contexts we already have it. And > there's no such thing as run-time resolution of namespaced class names. Yes, you are right. static::class would be equivalent to get_called_class() and $foo::class would be equivalent to get_class($foo). >> static::class, but also would allow $obj::class. Not sure this is >> really necessary, but it would be more consistent :) > > $obj::class means "class" constant of the class whose name is given by > string variable $obj. Probably not what you intended. And you have > get_class() already. As already mentioned, There can't be a class constant called "class", because it is a keyword. (const class = 'Foo' is a syntax error). But yes, I agree that runtime resolution only duplicates existing behavior, so it isn't really necessary (you could argue thought that self::class similarly also only replicates the existing __CLASS__). It would be nice for consistency in my eyes, but I'm good without it too :) Nikita