Posted by Jon Slaughter on 06/07/07 00:56
is there any way to simply add an attribute like feature to a
function/method definition?
say I create a function like
function Test()
{
//....
}
but I want to assign a probability to it in the definition itself... maybe
something like
function Test()
{
static $probability = 0.234321;
//....
}
Now is there any way that I can get the probability from the function? I'm
using function pointers to call the functions in a random way. Essentially
having a list of functions that have assigned probabilities and calling them
based on that probability(I don't want to really seperate the probability
from the definition.
Ultimately it would be nice to extend the syntax to handle a new keyword
like
function Test():[Probability=0.123421]
{
}
or something like that but I know thats not going to happen.
Thanks,
Jon
Navigation:
[Reply to this message]
|