Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:6341 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40824 invoked by uid 1010); 10 Dec 2003 22:42:17 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 40776 invoked from network); 10 Dec 2003 22:42:17 -0000 Received: from unknown (HELO mail.sites-secure.com) (213.189.34.71) by pb1.pair.com with SMTP; 10 Dec 2003 22:42:17 -0000 Received: by mail.sites-secure.com (CommuniGate Pro PIPE 3.5.9) with PIPE id 2129164; Thu, 11 Dec 2003 00:44:51 +0200 Received: from [192.117.106.24] (account netcat@abox.co.il HELO c15.loc) by mail.sites-secure.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 2129158; Thu, 11 Dec 2003 00:44:42 +0200 To: Justin Hannus Cc: internals@lists.php.net In-Reply-To: <20031210204738.31449.qmail@pb1.pair.com> References: <3FD67054.2030000@zworg.com> <3FD762B5.1080908@highsidecafe.com> <20031210204738.31449.qmail@pb1.pair.com> Content-Type: text/plain Message-ID: <1071096120.16656.40.camel@c15.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Thu, 11 Dec 2003 00:42:00 +0200 Content-Transfer-Encoding: 7bit X-DoalSignature: rot-3 (smtp) Subject: Re: [PHP-DEV] With End With From: netcat@abox.co.il (netcat) 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