| import |
|
grammar |
| |
A directive which causes the specified value to be brought into the
global
dictionary.
When the value is a dictionary and is followed by a dot-star
(.*),
then all the elements in the dictionary are imported.
Its usage description can be summarized as follows:
Statement:
import Lvalue ;
import Lvalue .* ;
| |
| Example: |
In the following example, the effects of importing
are demonstrated when the elements in the
global
dictionary are
displayed after each
import.
Notice that the declaration puts the dictionary into the
global
environment, but not its elements until
import
is used.
yoix.stdio.printf("global (initially): %O\n", global);
import yoix.stdio.printf;
printf("global (printf imported): %O\n", global);
Dictionary mydict = {
int YES = 1;
int NO = 0;
int HIGH = 1;
int MEDIUM = 0;
int LOW = -1;
};
printf("global (mydict declared): %O\n", global);
import mydict.YES;
import mydict.NO;
printf("global (YES/NO imported): %O\n", global);
import mydict.*;
printf("global (mydict imported): %O\n", global);
The result on standard output looks like:
global (initially): Dictionary[5:0]
argc=1
argv=Array[1:0]
envp=NULL:ARRAY
errordict=Dictionary[7:0]
>typedict=Dictionary[76:0]
global (printf imported): Dictionary[6:0]
argc=1
argv=Array[1:0]
envp=NULL:ARRAY
errordict=Dictionary[7:0]
printf=att.research.yoix.YoixBuiltinsStdio.printf(a1, ...)
>typedict=Dictionary[76:0]
global (mydict declared): Dictionary[7:0]
argc=1
argv=Array[1:0]
envp=NULL:ARRAY
errordict=Dictionary[7:0]
mydict=Dictionary[5:0]
printf=att.research.yoix.YoixBuiltinsStdio.printf(a1, ...)
>typedict=Dictionary[76:0]
global (YES/NO imported): Dictionary[9:0]
NO=0
YES=1
argc=1
argv=Array[1:0]
envp=NULL:ARRAY
errordict=Dictionary[7:0]
mydict=Dictionary[5:0]
printf=att.research.yoix.YoixBuiltinsStdio.printf(a1, ...)
>typedict=Dictionary[76:0]
global (mydict imported): Dictionary[12:0]
HIGH=1
LOW=-1
MEDIUM=0
NO=0
YES=1
argc=1
argv=Array[1:0]
envp=NULL:ARRAY
errordict=Dictionary[7:0]
mydict=Dictionary[5:0]
printf=att.research.yoix.YoixBuiltinsStdio.printf(a1, ...)
>typedict=Dictionary[76:0]
| | |
| See Also: |
Dictionary,
global,
include,
reference
|
|
Yoix is a registered trademark of AT&T Intellectual Property.
|