Updated doc.txt to speak about dynamic

svn: r566
This commit is contained in:
Kathy Gray 2005-08-08 16:50:25 +00:00
parent 66c34004ea
commit 6418b30860

View File

@ -14,6 +14,55 @@ interaction boxes, and test-suite boxes. (i.e. what would be given to
javac plus two graphical boxes). Descriptions of these boxes can be
found in the DrScheme manual.
_Java + dynamic language level
Version 299.200 +
This language level allows programs to contain a value that will be
checked dynamically rather than statically.
The following code presents the use of a dynamically typed value, that
will be checked during execution.
class RuntimeCheck {
int checkForNumber( dynamic var ) {
return var;
}
}
In RuntimeCheck, var will be checked to be an integer when checkForNumber
is executed. Values declared with type 'dynamic' can also be used as
any primitive or object value in Java. In addition, values with type
'dynamic' can also be used as methods: var() is a legal use.
Within the Java + dynamic language level, Scheme libraries may be
imported and used within the Java program.
The import form is either:
import scheme.lib.$PATH$;
import scheme.$PATH$;
where $PATH$ is the set of directories that leads to the Scheme module, ending
with the modules name. The lib form is used to access Scheme modules within the
collects hierarchy.
The Scheme require statement (require (lib "compile.ss" "profj")) would be written
import scheme.lib.profj.compile;
within Java + dynamic
Values provided by the scheme libraries may be used within a Java program, with
access to them treated as though the Scheme module were a class and the provided
value a static member. If the compile module mentioned above provides a types
function, this would be accessed with the following code:
... compile.types() ...
This value has type dynamic within the Java program, and will be dynamically checked
based on use.
As many Scheme names are not valid Java names, the following automatic name translations
will be used:
Scheme name <-> Java name
make-foo <-> makeFoo
foo? <-> fooP
foo->string <-> fooToString
set-foo-baz! <-> setFooBazSet
object% <-> objectObj
_Libraries available to ProfessorJ:
*NEW* Items are new to either DrScheme 207 or DrScheme 208