| Function |
|
typedict |
| |
A variable that is declared to be a
Function
accepts any function, but the value that is actually
stored in that variable must be created somewhere else
using the Yoix function definition syntax.
Uninitialized
Function
variables, no matter where they happen to be declared,
always start as
NULL.
| |
| Example: |
The program,
import yoix.*.*;
Sleeping(arg) {
printf("Sleeping: arg=%d\n", arg);
sleep(arg);
}
Quitting(arg) {
printf("Quitting: arg=%d\n", arg);
exit(arg);
}
Function Running = Sleeping;
Thread timer = {
run() {
sleep(3);
Running = Quitting;
}
};
timer.run();
while (1)
Running(1);
may look like an infinite loop, but it prints something like,
Sleeping: arg=1
Sleeping: arg=1
Sleeping: arg=1
Quitting: arg=1
on standard output because the timer thread wakes up after a few
seconds and changes the definition of Running.
| | |
| See Also: |
Builtin,
Callable,
Number,
Object,
Pointer
|
|
Yoix is a registered trademark of AT&T Intellectual Property.
|