| Overview | Module | Function | Class | Tea 3.2.5 Reference Documentation © 2009 PDM&FC |
import fileName
Executes Tea code read from a file.
fileName.
If fileName was previously imported
and it is not re-executed,
it returns $null.
(It is not advisable to write code that depends on the return value
of import, as this behaviour might change in future versions.)
import
function is called.
If the import function is called subsequently for the same
fileName,
its contents will be read and executed again only if the file's last
modification timestamp has changed since the last time it was executed. This
behaviour only applies when the file is read from the filesystem. If the
fileName
is found within an archived library (jar) or other URL library source,
it will only be imported once.
The global variable TEA_LIBRARY should define a list
of strings representing URLs where
fileName is searched. If TEA_LIBRARY
is undefined or not a list, fileName is
searched in the current directory. If TEA_LIBRARY
is an empty list, the file is never searched and import
will fail. If two different fileName are mapped into the
same full path name, they are considered to be the same file.
The execution of the Tea code is done in a new execution context,
descendent from the global context. As such, if the Tea code executed
defines new variables with top level define statements,
these variable names will not be know outside the scope of
fileName, but its lifetime will be the same as the Tea
process. (Similar to static variables in the C programming language,
wich are only known inside the module that defines them.)
| Overview | Module | Function | Class | Tea 3.2.5 Reference Documentation © 2009 PDM&FC |