--- Brad LaFountain <[EMAIL PROTECTED]> wrote:
> Date: Mon, 17 Mar 2003 05:42:37 -0800 (PST)
> From: Brad LaFountain <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [PHP-DEV] __call for the namespaces
> 
> This idea spawned from playing with ext/rpc and the ability to declare
> class types on the fly....
> 
> Since zend_namespaces is really _zend_class_entry I think it would
> be cool to implement __call at the namespace level.
> 
> namespace java {
>  function __call($classname) {
>    // this will be called every time a new java::$classname() is called
>    // and $classname isn't defined
>    eval("
>     class $classname {
>     }
>    ");
>    // and it can return the new class
>    return new $classname();
>  }
> }
> 
> This doesn't seem like it would be too hard to implement and it will allow me
> to do stuff like...
> 
> <?
>  $j = new java::java.util.Stack();
>  // $j could be of ns java:util and class Stack
>  $s = new soap::myObject("http://server/some.wsdl";);
>  // $s could be the namespace defined in the wsdl and of class myObject
> ?>
> 
> ps:
> <?
> namespace test {
>       class test1 {
>               function doSomething() {
>                       eval("
>                       class test2 { }
>                       ");
>               }
>       }
> }
> 
> $test1 = new test::test1();
> $test1->doSomething();
> ?>
> results in...
> <b>Fatal error</b>:  Internal Zend error - Missing class information for  in
> <b>
> c:\php\php5\Release_TSDbg\name.php(7) : eval()'d code</b> on line <b>2</b><br
> />
> 
> 
>  - Brad
> 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online
> http://webhosting.yahoo.com
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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

Reply via email to