Derek Posted December 3, 2003 Share Posted December 3, 2003 A new construct was suggested by one \'oododa\'; his brainchild of sorts, which I rather enjoyed and wish to impliment. Here is a description, shorthand. Usage: with( $obj ) { method(); method(); echo $object_property; } Description: The \'with\' construct will pull all methods and object properties of $obj into the scope in which \'with\' was used. Upon exit of \'with\', scope will be destroyed, and to use the methods or properties again (out of object scope), you will have to enter into another \'with\'. Eg: [php:1:a8f599f1ce]<?php $thing = &new Thing; with( $thing ) { doStuff(); // Thing::doStuff() echo $obj_property; doOtherstuff(); // Thing::doOtherStuff() } function Stuff( &$thing ) { with( $thing ) { echo $obj_property; doOtherStuff(); doStuff(); } return $obj_property; // Error, $obj_property is in object scope. // $thing->obj_property should be used. } ?>[/php:1:a8f599f1ce] If you would like to help out, leave a reply. Quote Link to comment https://forums.phpfreaks.com/topic/1459-new-construct-welcome-help-with-implimentation/ Share on other sites More sharing options...
gluck Posted January 8, 2004 Share Posted January 8, 2004 What help do you need ? Quote Link to comment https://forums.phpfreaks.com/topic/1459-new-construct-welcome-help-with-implimentation/#findComment-5255 Share on other sites More sharing options...
Derek Posted January 10, 2004 Author Share Posted January 10, 2004 absolutely none, as we have discussed it on the internals list, and it seems we can't agree on anything in particular. It seems this one will fall into the cracks. Quote Link to comment https://forums.phpfreaks.com/topic/1459-new-construct-welcome-help-with-implimentation/#findComment-5261 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.