ProfessorJ: Java in Racket
ProfessorJ is a plug-in for DrRacket that implements variants of Java, especially for teaching purposes. After installing ProfessorJ (and restarting DrRacket, if necessary), use the Choose Language... dialog in DrRacket to select one of the languages. For information on the supported languages, see How to Design Classes Languages.
ProfessorJ’s languages are also available for use with #lang. For example,
#lang profj/full class Example { static String result = null; public static void Main(String[] args) { result = "Hi"; } }
is a program in ProfessorJ’s Full language. The Racket view of this module is that it has an Example submodule that exports an Example class, an Example-main-java.lang.String1 function, and an Example-result~f variable, among other bindings.
1 ProfessorJ Languages for Racket Modules
#lang profj/beginner | package: profj |
#lang profj/intermediate | package: profj |
#lang profj/intermediate+access | package: profj |
#lang profj/advanced | package: profj |
#lang profj/full | package: profj |
#lang profj/dynamic | package: profj |
2 Class Search Paths
When ProfessorJ compiles a program that includes a reference to a class C, it searches for the class’s definition with the following sequence:
as defined in the current source file;
as described by a file "compiled/C.jinfo" and implemented by "C.rkt" or "compiled/C_rkt.zo" (where "rkt" can be "ss", instead);
as exported by "C.ss" or "C.scm", but only as referenced from the ProfessorJ Dynamic language;
as described by a jinfo submodule of "C.rkt", which corresponds to a #lang profj/... module.
as implemented in "C.bjava", "C.ijava", "C.iajava", "C.ajava", "C.ajava", or "C.djava", where the file suffix determines the ProfessorJ language variant—
but in this case, the information is sufficient only to read the referencing code, not expand or compile it.
A ProfessorJ source file as in the last case normally must be compiled in advance to "compiled/C.jinfo" and "compiled/C_rkt.zo" files.