Bug #14404: scope notation

From: Date: Mon, 10 Dec 2001 15:32:01 +0000
Subject: Bug #14404: scope notation
Groups: php.dev 
Request: Send a blank email to php-dev+get-73070@lists.php.net to get a copy of this message
From:             foobardotcom@poczta.onet.pl
Operating system: all
PHP version:      4.1.0
PHP Bug Type:     Feature/Change Request
Bug description:  scope notation

What are callbacks? I have created my callback system, and it is working
like that:

class Foo {
  function sum($a, $b) {
    return $a + $b;
  }
}
$staticCB = new Callback("Foo", "sum");
echo $staticCB->execute(array(5, 3)); // should result '8'
$myFoo = new Foo();
$instanceCB = new Callback($myFoo, "sum");
echo $instanceCB->execute(array(2, 4)); // should result '6'
function mySum($a, $b) { return $a + $b;}
$funcCB = new Callback(null, "mySum");
echo $funcCB->execute(array(1, 2)); // should result '3'

I want, you make possible to specify SCOPES, without dummy walkarounds like
strings or variables, so make this possible:

$staticCB = new Callback(Foo::sum);
$instanceCB = new Callback($myFoo->sum);
$funcCB = new Callback(mySum);
-- 
Edit bug report at: http://bugs.php.net/?id=14404&edit=1



Thread (1 message)

  • foobardotcom at poczta dot onet dot pl
« previous php.dev (#73070) next »