Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62982 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77305 invoked from network); 13 Sep 2012 20:51:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Sep 2012 20:51:29 -0000 Authentication-Results: pb1.pair.com header.from=ralph@ralphschindler.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ralph@ralphschindler.com; spf=permerror; 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:33665] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/28-31416-05742505 for ; Thu, 13 Sep 2012 16:51:28 -0400 Received: by obbwc18 with SMTP id wc18so5664266obb.29 for ; Thu, 13 Sep 2012 13:51:25 -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=8oxycjpIKiwkQJv+Go+iVYHVhDL9maZSGPwebQMoCCI=; b=hJzMtfVDCEGhzWrhMcQTwjd0MtaxWPrmjSQ5bYxCSDtGDFGFzddRT+CLJM2KJvIQjs /+nITYVObWOoHztRPsCtXnsWdb+EEJ76WzlT3De4IdLyLuKwM9ST2lYQjWmaMwLjia48 ZNTLbnxnRAVBxa0YsZ9IKaAcUOKvoy95/G5AdcsUVS3HmUF8n2WFgCZRByiQcKQMXP+b Y8gRGqlP4I3hEmR9CfZ6JOsLzwTD+gNbebuNjydtqO9G3DEQPG6yIYzVTK9qxZjpgxxV AhYuM/ZSEh+ShOQ/dRmeTyRkV1LNGRHA11jNMVxA/kfaSnafc1ohXWKA907DXs9Xicno gYcw== Received: by 10.182.152.36 with SMTP id uv4mr543275obb.81.1347569484960; Thu, 13 Sep 2012 13:51:24 -0700 (PDT) Received: from Ralphs-Mac-Pro.local (ip174-73-14-247.no.no.cox.net. [174.73.14.247]) by mx.google.com with ESMTPS id qd7sm25095639obc.5.2012.09.13.13.51.24 (version=SSLv3 cipher=OTHER); Thu, 13 Sep 2012 13:51:24 -0700 (PDT) Message-ID: <5052474B.5050706@ralphschindler.com> Date: Thu, 13 Sep 2012 15:51:23 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Dmitry Stogov CC: internals References: <504F4D33.4070306@ralphschindler.com> <5051968E.7030908@zend.com> In-Reply-To: <5051968E.7030908@zend.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnKjuk+vTkhivB4LcjUInPMVVQvUxcLdMRyqz7nKxH3J3r1F9YSgCAy/OlxxcQLfsLNbpem Subject: Re: [PHP-DEV] [VOTE] ::class feature to resolve namespaced class names to scalars From: ralph@ralphschindler.com (Ralph Schindler) > I think the syntax is wired. > Instead of classname::class I would prefer something like class(classname). > I am not a big fan of the syntax class(ShortClass\Name) as to me it looks like a function call. Personally, I like drawing parallels from the same languages that I think helped shaped PHP's object-model. In this case, the Java has a similar enough feature where Type.class returns a class object (in our case we just need to return a string of the FQ class name). Your suggestion is similar to that of, I think, C# where typeof(SomeClassName) would return a reflection-like/type object where you could get the FullName(): http://msdn.microsoft.com/en-us/library/58918ffs%28v=vs.71%29.aspx I could go either way, at this point (after the April discussion on the matter), I had not really given much thought to class() lang. construct. Personally, ::class feels a bit better to me in that the context feels more "compile-time", like __CLASS__, and the NS resolutions, than does class() that you suggest. From a wider perspective, I've seen these variations in the wild: class Foo { const CLASSNAME = __CLASS__; // or const _class = __CLASS__; } Which allows for the usage: Foo::CLASSNAME; for example. FWIW, both reusing the class() keyword making it BC, which is something I like. -ralph