Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29845 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13290 invoked by uid 1010); 28 May 2007 15:42:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 13275 invoked from network); 28 May 2007 15:42:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 May 2007 15:42:04 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain php.net from 85.214.94.56 cause and error) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Received: from [85.214.94.56] ([85.214.94.56:49916] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/7E-47763-A48FA564 for ; Mon, 28 May 2007 11:42:04 -0400 Received: from baumbart.mbo (dslb-084-063-061-077.pools.arcor-ip.net [84.63.61.77]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 270B21B3641; Mon, 28 May 2007 17:42:00 +0200 (CEST) Date: Mon, 28 May 2007 17:42:06 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <712442381.20070528174206@marcus-boerger.de> To: Wez Furlong CC: PHP internals In-Reply-To: <4e89b4260705280833t34f8fa53k6ad6527d5a215275@mail.gmail.com> References: <4e89b4260705280833t34f8fa53k6ad6527d5a215275@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC: adding a callback for determining if a method is static From: helly@php.net (Marcus Boerger) Hello Wez, Monday, May 28, 2007, 5:33:37 PM, you wrote: > Hello, > This weekend I've been building an Objective-C runtime bridge for PHP. > This is somewhat like the COM extension in that it is possible to > dynamically interrogate the Objective-C runtime to determine all the > interfaces (known as protocols) and classes and map those into PHP. > (it's also possible to go the other way, but that's not relevant to my > topic here). > Now, Objective-C allows one to enumerate static methods defined on > interfaces, but not in classes. Furthermore, there is something > vaguely akin to our __call mechanism that allows classes and instances > to magically handle methods without explicitly defining them in the > class description. > What I'd like to be able to do is this: > $NSApp = NSApplication::sharedApplication(); > but the sharedApplication() static method doesn't appear in the > enumerated list of methods in the runtime, so I can't simply add it to > my function table when I register the NSApplication class. > So what I need to do is this to work around the issue: > $NSApp = NSApplication::__staticInvoke('sharedApplication'); > This can ask the runtime if "sharedApplication" is a static method and > invoke it appropriately. > This wouldn't be especially bad if it was only for one or two classes > that were no often used, but it crops up a lot. > I'd like to see an additional callback in the zend_class_entry that > operates similarly to the existing get_method callback, but that takes > the zend_class_entry instead of the object pointer as its parameter. > That would enable more natural syntax for this application, and likely > other bridging extensions too. > Thoughts? yes :-) Along with __call and what you propose, we're missing: __method_exists(string $name, [bool $static = false]); Best regards, Marcus