Re: do_declare_property()

From: Date: Wed, 12 Jul 2000 15:09:52 +0000
Subject: Re: do_declare_property()
References: 1 2 3 4 5 6  Groups: php.dev 
Request: Send a blank email to php-dev+get-24322@lists.php.net to get a copy of this message
At 16:13 12/07/00 +0300, Teodor Cimpoesu wrote:
Hi Andi! On Wed, 12 Jul 2000, Andi Gutmans wrote: Yeah but I assume python *knows* what type z is at compile time, right? Andi uhm, what for? Of course it will know it's a class, and when parsing the class def. the rewrite takes place. Of course, we don't really need to have `$this->__bar', I though we can also have private var $bar', and rewrite the member to _Class__bar' to ensure it's `privateness'.
I think you missed what I said. Consider the following example: function foo($obj) {
        $obj->bar;
} You have no idea what type (and/or class type) $obj is at compile-time. So you can't know if $obj's bar property is private or not. However, if you'd have the following syntax: function foo(class MyObject $obj) {
        $obj->bar;
} You could know at compile time if the MyObject class's bar member was defined as private. Andi --- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.dev (#24322) next »