Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63006 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11384 invoked from network); 14 Sep 2012 15:13:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Sep 2012 15:13: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:51825] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/A0-02694-28943505 for ; Fri, 14 Sep 2012 11:13:07 -0400 Received: by obbwc18 with SMTP id wc18so6918937obb.29 for ; Fri, 14 Sep 2012 08:13:04 -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:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=yVv3CjluObMQ+fco1NtWc3N6djE1a6XMHa23vWV9TSA=; b=FrGgOjwVxQnjjXh7/LFswuUcFAVzKKHUM2aM2svcl8eOuBXiZVhYn+4MpMxKErM0DF njLyGsQlQOeGmDJ6ga3UZg4ZguKn5YIHkrHo7ZnKGOWfWbgMedvC2i6WsY7bHXIlH241 psK+k1g7n9rjddd3Z1i6zM6cjqS8ZIjTmIsQTul8JS31v8YfS0bllpQGuEAV/DEUmQU7 V8hiyrPtFFGUByNE/3ExBM1XbqAAZ5A+t9w3VV1EtdXeFpCJUERyMXV2rA7Kfg2t2iJy Wgf29fV84sdEAYDXaMvcc/Mnmpt4EzjTKZ9UG/0Jh6vAvqbJWy9oTTF37Iz8SbejXMO4 YJeQ== Received: by 10.60.13.2 with SMTP id d2mr3697472oec.110.1347635584242; Fri, 14 Sep 2012 08:13:04 -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 ig3sm2104457obb.0.2012.09.14.08.12.59 (version=SSLv3 cipher=OTHER); Fri, 14 Sep 2012 08:13:03 -0700 (PDT) Message-ID: <5053497A.9070001@ralphschindler.com> Date: Fri, 14 Sep 2012 10:12:58 -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: internals@lists.php.net References: <504F4D33.4070306@ralphschindler.com> <5051968E.7030908@zend.com> <5052474B.5050706@ralphschindler.com> <5052E5EC.2030103@zend.com> <5052ED65.7020200@rotorised.com> In-Reply-To: <5052ED65.7020200@rotorised.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQkY3Xw4ucmcZdnb45u5KcoeSRyRamrYaaxXpQPM+UaC0+E9DCr+ADSzenAhMHfvpD0LtGRT Subject: Re: [PHP-DEV] [VOTE] ::class feature to resolve namespaced class names to scalars From: ralph@ralphschindler.com (Ralph Schindler) > I somewhat agree; using __CLASS__ would make it more obvious that it's > compile-time rather than runtime, IMO. > It's not always going to be compile-time. For self::class and Foo::class, it will be compile time every time. For static:class and parent::class, that has to be done at runtime as the class_entry is not completely hooked up (active_class_entry does not have parent* pointer, even if the class is extended). The 99% use case is: Foo::class, where a short name can be resolved against the current namespace and current import/use statements. The rest of the use cases, as we've seen, are going to be filled out for consistency. That means that: class Foo { const SOMECLASSNAME = static::class; // or parent::class } Will/should result in an E_FATAL (this use case doesn't really make a ton of sense anyway, but people are likely to do it). (I *think* the same applies for method signatures too, btw.) >> That is the reason why I voted "no", but more because of the token >> used than the feature. >> I previously stated that I preferred __CLASS__ as well to be more in >> line with what we currently have, I haven't changed my mind since the >> arguments provided didn't convinced me at all. I guess I can't convince preference :) I prefer ::class over ::__class__, and in that only marginally, because its shorter. After all, the whole point of this feature is because people are using namespaces (for the shortness of class names) and they need to use long class names as string, but want all the benefits of the namespacing/aliasing in the current scope. -ralph