> -- Piotr Kabaciński <kabot@seo.pl> wrote
> (on Sunday, 22 February 2009, 09:51 PM +0100):
>> I wonder why all attributes are kept like common object attribute and
>> why methods like get/setAttrib operate on $this->$name.
>>
>> Wasn't it faster if there is array eg. $this->attributes and every
>> operation on attribute will be simple get $this->attributes[$name]?
>
> You're forgetting that get/setAttrib() are not the only way to affect
> these attributes: the primary API is to use overloading.
>
> The solution you present may be faster when you want to get at all
> attributes at once (a micro-optimization at best), but not when you want
> to retrieve a single attribute -- if you use overloading, it will
> actually be faster, as you'll be grabbing a public property.
Ok, i must say i am little bit convinced. But i still think it is not
very elegant to retrive all parameters and then unset these which are
not start with '_'. Would be nice if i could list all of it without any
additional action.
greetings
--
Piotr Kabacinski
a2Fib3Q
没有评论:
发表评论