Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49191 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59732 invoked from network); 31 Jul 2010 12:45:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2010 12:45:08 -0000 Received: from [127.0.0.1] ([127.0.0.1:5549]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 28/60-55997-4DA145C4 for ; Sat, 31 Jul 2010 08:45:08 -0400 Authentication-Results: pb1.pair.com smtp.mail=ignas.rudaitis@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ignas.rudaitis@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ignas.rudaitis@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:37442] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E5/20-55997-B93145C4 for ; Sat, 31 Jul 2010 08:14:19 -0400 Received: by bwz11 with SMTP id 11so1412095bwz.29 for ; Sat, 31 Jul 2010 05:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=yZvAXcX5d3sRxSVm1bWXkGu8LYHcGyfrosrRefLYhT4=; b=hs0gmt88gXr9W3tlpmPiO5962gE2plTKVP6StmQlJTZ1mW5DkiOsbVtm7JZXwdrRd6 lB4WwlBo10mDf6i6vYnR7cWlKIwTIvlgLTJ6/cPxKPlXaidk+JH3D/pHbSjdEmv5kDvY kV+yDHG7d74VzpXB46bq1NNnbikhneR1Q80bQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=M+Usi57nP24XhRP4fDJtaup7Zd2xw3Z1/WwQlLpypTa4WY7KsrhwvvP5IxZEOt3cUQ awRRtKoxy9FHkLw6PjDcl8xcVXBFxeHR+/HaFNsalag5mDrXMKJNTmtZ3wK9r5Dr8aTg HKlwJFVa2mFFz+Ht/KVNqVTiXQXGpJYjLWeEA= MIME-Version: 1.0 Received: by 10.204.34.2 with SMTP id j2mr2222839bkd.21.1280578452240; Sat, 31 Jul 2010 05:14:12 -0700 (PDT) Received: by 10.204.85.71 with HTTP; Sat, 31 Jul 2010 05:14:12 -0700 (PDT) Date: Sat, 31 Jul 2010 15:14:12 +0300 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Feature proposal: userland support for name qualification From: ignas.rudaitis@gmail.com (Ignas Rudaitis) Hello php.internals, Here is a (hopefully) simple language feature I'd like to suggest: Now that PHP has support for namespaces and therefore makes it possible to refer to classes, functions and constants by their shorter unqualified aliases, it would be useful to extend this functionality to string references to these classes/functions/constants as well. Perhaps it wouldn't be as useful for constants, but class and function names need to be used as string literals from time to time, so given that a statement like "use Foo\Bar\Baz" is present, having a special syntax for retrieving the fully qualified name as a string, like Baz::__CLASS__, qualify(Baz) or use(Baz) would save numerous keystrokes, eliminate possible typos and make refactoring (renaming) easier. The use cases that come to my mind are class names in exception messages, in DI container setup code, also things like Doctrine's $entityManager->getRepository('Application\Entities\Message') and callable function name strings. Of course, if it's actually problematic to implement this, that's fine, just let me know. Thanks.