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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to