Jump to content


Photo

New Construct! welcome help with implimentation.


  • Please log in to reply
2 replies to this topic

#1 Derek

Derek
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationTennessee

Posted 03 December 2003 - 06:38 PM

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.
function comment(s)

{

	if (i_know_what_to_do_shut_up_i_dont_need_your_help_mode) {
   return  	} else {    return s  	}  }
ext/skeleton/create_stubs, lines 40-47. - PHP Core

#2 gluck

gluck
  • Members
  • PipPipPip
  • Advanced Member
  • 216 posts

Posted 08 January 2004 - 11:26 PM

What help do you need ?
I'm back baby!

#3 Derek

Derek
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationTennessee

Posted 10 January 2004 - 06:51 AM

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.
function comment(s)

{

	if (i_know_what_to_do_shut_up_i_dont_need_your_help_mode) {
   return  	} else {    return s  	}  }
ext/skeleton/create_stubs, lines 40-47. - PHP Core




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users