Re: [PHP-DEV] do_declare_property() From: Andi Gutmans (andi <email protected>)
Date: 07/12/00

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 <email protected>>
http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>