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=new 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. ========================================== 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 This document should only be read by those persons to whom it is addressed. Its contents are private and confidential. If you receive this email in error, please notify the sender immediately and do not disclose, copy or distribute this message, or open any attachments. -----Original Message----- From: Sebastian [mailto:[EMAIL PROTECTED] 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=new class; $class->do_something(); $class->do_more(); $class->do(); --------------------------- could be made easier and more readable: --------------------------- $class=new class; with($class) { do_something(); do_more(); do(); } --------------------------- greetings Sebastian -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php