Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41544 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93056 invoked from network); 29 Oct 2008 07:35:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Oct 2008 07:35:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 69.16.228.148 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 69.16.228.148 unknown Linux 2.4/2.6 Received: from [69.16.228.148] ([69.16.228.148:60630] helo=host.fmethod.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 53/37-48169-94218094 for ; Wed, 29 Oct 2008 02:35:37 -0500 Received: from [83.228.56.37] (port=1475 helo=pc) by host.fmethod.com with esmtpa (Exim 4.69) (envelope-from ) id 1Kv5aX-0008OB-Iw for internals@lists.php.net; Wed, 29 Oct 2008 02:35:33 -0500 Message-ID: <7E40142348CB4407881593314363972A@pc> To: Date: Wed, 29 Oct 2008 09:35:22 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0020_01C939A9.AA6323D0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.fmethod.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - fmethod.com Subject: Proposal for new construct: nameof From: sv_forums@fmethod.com ("Stan Vassilev | FM") ------=_NextPart_000_0020_01C939A9.AA6323D0 Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: quoted-printable Hi, With namespaces and "use" we'll be introducing a new kind of discrepancy = between a string reference to a function, and the short "use"-enhanced = name for the same function. This becomes very painful, when I want to = load a function before I run it. Today I would do (due to lack of function autoload.. hopefully one = day..): =20 F::loadFunc('Foo_Bar_Baz'); =20 echo Foo_Bar_Baz(); Tommorow I could attempt to do: use Foo\Bar as B; F::loadFunc('B\Baz'); <-- failure, strings are not resolved agains the = use statements echo B\Baz();=20 so it becomes: use Foo\Bar as B; F::loadFunc('Foo\Bar\Baz'); <-- works, but negates some of the use for = "use"... echo B\Baz();=20 I suggest we introduce a new construct which will return a string when = passed any identifier to resolve against the current file's use clauses: nameof Symbol\Name; With this identifier, the above example can be "normalized" to the = following code: use Foo\Bar as B; F::loadFunc(nameof B\Baz); <-- will send 'Foo\Bar\Baz' as the argument echo B\Baz();=20 NOTE: As a side effect this means less direct writing of string = function/class names, and less complaints about \ being the escape = characters. Regards,=20 Stan Vassilev ------=_NextPart_000_0020_01C939A9.AA6323D0--