Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56659 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62072 invoked from network); 28 Nov 2011 20:45:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2011 20:45:31 -0000 Authentication-Results: pb1.pair.com header.from=me@evancoury.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=me@evancoury.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain evancoury.com designates 184.105.241.53 as permitted sender) X-PHP-List-Original-Sender: me@evancoury.com X-Host-Fingerprint: 184.105.241.53 mail.evan.pro Linux 2.6 Received: from [184.105.241.53] ([184.105.241.53:50271] helo=mail.evan.pro) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 15/E1-50663-AE2F3DE4 for ; Mon, 28 Nov 2011 15:45:31 -0500 MIME-Version: 1.0 X-DKIM: Sendmail DKIM Filter v2.8.3 mail.evan.pro 508694B300B6 DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=evancoury.com; s=default; t=1322513127; bh=ZO5fCbh4ILQXMsXKmuKTZDxpugQ=; h=In-Reply-To:References:From:Date:Message-ID:Subject:To:Cc: Content-Type; b=omeOqQVd0xZoycVgQ+uIu5rln3mq3iajPuIsolTGNSIm8HBROxJ0e8n2nzCIcVvNN 8gVqh9CNHC4FgGoLDLB5FLv/lnI0YQKfwbTOkCBG9O9XtwWabxWhFSmxv82eejdqdU uyq1E7EN0v7vC2koiS6cowG8UYmzadTAjWBdj89A= In-Reply-To: References: <008601ccae08$9fcff840$df6fe8c0$@alliantinternet.com> Date: Mon, 28 Nov 2011 13:45:05 -0700 Message-ID: To: Nikita Popov Cc: Dmitri Snytkine , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Any chance of having __invokeStatic() From: me@evancoury.com (Evan Coury) On Mon, Nov 28, 2011 at 1:11 PM, Nikita Popov wrote: > How would this be different from defining a function MyClass? Actually, I just found myself wanting this the other day. The class name in question was being defined in a config file, which the user would be free to override with their own class name (and a closure was ruled out because this config file could be xml/ini/etc). There are plenty of other ways I decided I could work around this, but I did stop and think that something like __invokeStatic() would be nice. My main rationale for wanting this was that classes can be resolved via an autoloader, whereas functions cannot. However, I could definitely see where this could get sticky. For example: What would the output be in a case like this? Right now, while it's horrible practice to share names across functions and classes, they don't actually share the same namespace. Something like __invokeStatic() would make it ambiguous in some cases (like above), so I'm not really sure how that could be resolved. -- Evan Coury