re-referencing and how we could enable this *without* pointers

From: Date: Sat, 19 Aug 2000 16:02:30 +0000
Subject: re-referencing and how we could enable this *without* pointers
Groups: php.dev 
Request: Send a blank email to php-dev+get-29675@lists.php.net to get a copy of this message
I´ve just spent another minutes on that topic and I think it could be possible. It *is* currently possible. Instead of this construct a user thinks to use (without having read my article): //$boo=&$barfoo; he can of course use this, because we´ve reference-counting there is *no* memory/performance impact on this, maybe it´s a bit complicated using three lines $tmp=$boo; $barfoo=&$boo; $boo=$tmp; thus I thought we could enable a construct like this $barfoo&=$boo; what acts like in the example 1) store the "value" of $boo temporary anywhere 2) create a reference "$barfoo" to the variable $boo (function-scope) $foo (global-scope) are referencing to 3) overwrite the variable with the temporary stored value That´s it! comments? Here´s the function all this code takes place in: function foo(&$boo) { $barfoo=3; //$boo=&$barfoo; $tmp=$boo; $barfoo=&$boo; $boo=$tmp; return $boo; } $foo=5; echo foo($foo);

« previous php.dev (#29675) next »