Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32722 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94533 invoked by uid 1010); 10 Oct 2007 14:04:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 94514 invoked from network); 10 Oct 2007 14:04:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Oct 2007 14:04:24 -0000 Authentication-Results: pb1.pair.com header.from=rblack@datavisibility.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rblack@datavisibility.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain datavisibility.co.uk from 213.123.238.215 cause and error) X-PHP-List-Original-Sender: rblack@datavisibility.co.uk X-Host-Fingerprint: 213.123.238.215 host213-123-238-215.in-addr.btopenworld.com Windows 2000 SP4, XP SP1 Received: from [213.123.238.215] ([213.123.238.215:47625] helo=datavisibility.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/46-55062-1EBDC074 for ; Wed, 10 Oct 2007 10:04:21 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Wed, 10 Oct 2007 15:04:10 +0100 Message-ID: <29A1574822BA7C4F8498BBBA0A36F1F30974D1@grizzly.DataVisibility.local> In-Reply-To: <2C.E0.51252.D52DB074@pb1.pair.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] new feature -> with() thread-index: AcgLRIuvA1Fg9kSqRuaZvYbcUrJLrQAASKqA To: "Sebastian" , Subject: RE: [PHP-DEV] new feature -> with() From: rblack@datavisibility.co.uk ("Richard Black") References: <2C.E0.51252.D52DB074@pb1.pair.com> I'm usually a lurker on here, but thought I'd through in my 2p on this one... Delphi (Object Pascal) has a similar feature, that I've had some experience of using, and I never liked it. Why? Because it only leads to confusion, mainly because the separation of object and method leaves you unsure of what is actually being called. Consider the following: function do() { echo "hello"; } $class=3Dnew class; with($class) { do_something(); do_more(); do(); } Now, within my with(), am I calling the class method do() or the function do()? Not clear at first glance. And the whole thing gets even more complex if you can start nesting with() constructs. I suspect this wouldn't be trivial to implement, and for me it doesn't add any value - only potential confusion. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 Richard Black - Senior Consultant DataVisibility Ltd Tel. 020 7917 9570 http://www.datavisibility.com/ ------------------------------------------------------------------------ -------------------- Registered Office: 212 Piccadilly, London, W1J 9HF Registered in England No. 5891154 VAT No. 8877891834 =20 This document should only be read by those persons to whom it is addressed. Its contents are=20 private and confidential. If you receive this email in error, please notify the sender immediately=20 and do not disclose, copy or distribute this message, or open any attachments. -----Original Message----- From: Sebastian [mailto:sebastian@ifyouwantblood.de]=20 Sent: 09 October 2007 20:12 To: internals@lists.php.net Subject: [PHP-DEV] new feature -> with() hi, i think it would be really handy to introduce the with() feature from JavaScript (and probably other OOP languages) into php. so for sample the following --------------------------- $class=3Dnew class; $class->do_something(); $class->do_more(); $class->do(); --------------------------- could be made easier and more readable: --------------------------- $class=3Dnew class; with($class) { do_something(); do_more(); do(); } --------------------------- greetings Sebastian=20 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php