On Wed, 2003-12-10 at 22:42, Justin Hannus wrote:
> I've used the "with (object)" construct in JavaScript before and I'm
> assuming it would work the same, but instead of:
> 
> With $obj
> ->methodCall();
> // ugly ...
> 
> it would be much sexier like:
> 
> with ($obj) {
>     methodCall();
> }
> 
> But its all just sugar. As far as implementing it in userland with a
> recursive function that merges properties, that's way to much unnecessary
> work. Why not just manually de-reference the object on subsequent method
> calls?
> 
> -justin

I guess your proposal is much simplier (if i understand it correctly)
but i personally prefer merging properties becuase of thinking:
1) I have some object
2) I want to change it's prop's
3) So I just "commit" (right word?, "apply" maybe) the changes

This way I can have something like that:
$styles=array('style1'=>
               array('font'=>'+2','bold'=>true),
              'style2'=>
               array('font'=>'-1','bold'=>false));

change_props_recursively($mytext,$styles[$cur_style]);

Well, having all the changes in a variable and not code
gives some advantages i believe... it can be passed, modified,
serialized... the applying function can be tweaked maybe ...

When the "change" should be computed I still prefer to compute
the recursive hash and apply it at once.

P.S.
 Just my 2 agoras.

[snip]


--------------------------------------------------------
FREE 10MB email + Antivirus + AntiSpam + POP3 + more....
Get it at http://www.doal.co.il:81/free/?c=both

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

Reply via email to