Artifact for “Binding as Sets of Scopes”
This artifact demonstrates the following claims from the paper:
scope sets are an effective model for hygienic macros;
the implementation with scope sets compares favorably to the previous implementation;
performance of the new implementation is on par with the old implementation; and
compatibility with existing Racket code is largely preserved.
The main part of the artifact is working version of Racket that uses scope sets for its macro expander. Since the Racket implementation is large, a miniature version of the macro-expander core is provided in the form of a PLT Redex model plus test cases. (More precisely, a sequence of models is provided, where each model corresponds to a subsection of the paper’s section 6.) The implementation provides a full-scale test, while the model is more reasonably human-checkable.
In addition to the macro system implementation and model, the artifact includes sources and results of building all packages from the Racket package registry.
For reference:
1 All-in-One Virtual Machine Image (Option 1)
The virtual machine image is intended as the distribution format of the artifact. The image contains a variant of this page, installed Racket versions, and an archive of packages and build results. In addition, we provide installers here for common platforms; you may find installing Racket on your machine natively to be easier for some purposes than running the virtual machine. For installers, see Installers and Models.
Virtual machine image (as OVF, built using VirtualBox)
username:
racket
password:
racket
This virtual-machine image includes the Racket versions listed in Installers and Models. Each version is installed in a subdirectory of the racket user’s home directory.
The formal model (which runs in the newest version of Racket) is provided in the "model" subdirectory of the racket user’s home directory. See "README.txt" there for more information.
Source code for each Racket version is archive in the "src" subdirectory of the racket user’s home directory.
A copy of the packages archives and build results described in Packages and Build Results are in the "artifact" subdirectory of the racket user’s home directory. The "index.html" file there is a variant of this page.
2 Installers and Models (Option 2)
These installers are useful only if you don’t go the virtual machine route as described in All-in-One Virtual Machine Image.
As an alternative to the virtual machine:
Racket version 6.2.900.17 implements the set-of-scopes macro expander. This version represents the latest implementation, and it is a pre-release of version 6.3.
Racket version 6.2.900.4 also implements the set-of-scopes macro expander. The paper submission was based on this version, so it is provided for complete consistency. Version 6.2.900.17 has fewer bugs, but with the same set-of-scopes core, so both are consistent with the paper’s model.
Racket version 6.2.1 implements the old, marks-and-renames expander —
for comparison with the new expander. Complete models from the paper in both executable form and typeset as PDF; see "README.txt" in the unpacked archive for more information.
While Racket releases are meant to allow multiple versions installed on a single machine, the version 6.2.900.17 and version 6.2.900.4 snapshot builds are configured in a potentially conflicting way. To avoid inteference between the versions, either install packages in only “installation scope” (as opposed to the default “user scope”) or configure the installations to have separate names by using
raco pkg config --set name ‹version-specific-name›
and optionally, just to be sure,
raco pkg config --set default-scope installation
Installations in the virtual machine of All-in-One Virtual Machine Image are configured this way.
3 Performance Tests
A basic test for the performance of the macro system is to bootstrap the racket language (which is built in many layers of macros on a kernel module) from source:
time racket -c -l racket
That process should take 10-20 seconds on a modern machine.
A more extensive test is to run raco setup --clean followed by raco setup, which will rebuild all installed Racket libraries to bytecode from source. Rebuilding on a single-core machine takes on the order of an hour.
Finally, each successful package build starts and ends with a timestamp, and a comparison of timestamps shows similar installation times. However, macro expansion tends to be a small part of that time.
4 Macro Expander Source
The virtual machine image contains source in the "src" subdirectory of the racket user’s home directory.
The full Racket source code is available from the installer page for each version in Installers and Models. The main changes to the implementation are in "syntax.c", which implements the syntax-object data structure; the source file "compile.c" implements the macro expander, and it has fewer relevant changes. As a shortcut, we provide those sources for each version:
Version 6.2.900.17: "syntax.c" and "compile.c"
Version 6.2.900.4: "syntax.c" and "compile.c"
Version 6.2.1: "syntax.c" and "compile.c"
Inspecting the code in any details is unlikely to be fruitful for most readers, but perhaps some impressions can be drawn from a high-level skim. In the old "syntax.c", the monster function resolve_env is responsible for resolving a binding; the closest corresponding code in the new "syntax.c" is do_stx_lookup with do_stx_lookup_nonambigious.
These production implementations include many details on top of the core implementation strategies, so a comparison of models may be more tractable. The models for the set-of-scopes expander can be compared to models of the old expander, particularly since both models are written in a similar style.
5 Packages and Build Results
The virtual machine image contains a copy of the package archives and build results in the "artifact" subdirectory of the racket user’s home directory.
The following logs show the results of building and testing all registered packages with the old and new macro expanders at two points in time.
May 2015: corresponds to the paper’s report; the old-expander build is for the version 6.2 release, while the new-expander build was before the new expander became part of the development branch (i.e., before an substantial number of Racket users started using the new expander).
Results with old expander (version 6.2)
Install failures: 18 out of 334 (with 62 additional packages in the distribution)
Results with new expander (version 6.2.900.4)
Install failures: 46 out of 334 (with 62 additional packages in the distribution)
Additional failures relative to version 6.2:
failing package
reason
failure source
3d-model
spurious (succeeds on retry)
afl
macro system change
alexis-multicast
macro system change
alexis-util
alexis-util
macro system change
alexknauth-my-object
macro system change
c
macro system change
cKanren
macro system change
base
control
macro system change
curly-fn
macro system change
echonest
macro system change
rackjure
frog
macro system change
rackjure
livefrog
macro system change
rackjure
markdown
macro system change
rackjure
match-string
macro system change
rackjure
measures-with-dimensions
macro system change
rackjure
mm
macro system change
base
pict3d
build timeout
pollen
macro system change
rackjure
pop-pl
macro system change
base
racket-lang-org
macro system change
rackjure
racquel
macro system change
semilit
macro system change
datalog
semver
macro system change
set-exp
macro system change
spmatrix
macro system change
base
spvector
macro system change
base
unicode-properties
build timeout
zordoz
other incompatibile change
Since version 6.2.900.3 changed essentially only the macro system relative to version 6.2, package failures are almost all due to that change. Furthermore, most problems originate with incompatibilities in a small number of packages. The base package refers to libraries in the main distribution, and those failures reflect errors in updating macros in the main distribution.
Archive of packages (as available May 2015)
Catalog link: http://www.cs.utah.edu/plt/popl16/pkg-build-renames-2015-05/archive/catalog/
October 2015: the current status; the old-expander build uses version 6.2.1, while the new-expander build uses verson 6.2.900.17. At this point, the new expander had been part of the main Racket development branch for about 3 months, so many Racket users had worked with it.
The set of packages that appear in the report is slightly different for each version, because this report does not show packages that are part of each distribution, and some packages moved into and out of the distribution.
Results with old expander (version 6.2.1)
Install failures: 38 out of 430 (with 62 additional packages in the distribution)
14 of these failures do not occur with version 6.2.900.17, because the failure is a dependence on newer Racket features.
Packages not in the other distribution: typed-racket-tests, unstable, unstable-2d, unstable-contract-lib, unstable-debug-lib, unstable-flonum-lib, unstable-latent-contract-lib, unstable-lib, unstable-list-lib, unstable-macro-testing-lib, unstable-options-lib, unstable-parameter-group-lib, unstable-pretty-lib, unstable-test.
Results with new expander (version 6.2.900.17)
Install failures: 48 out of 430 (with 62 additional packages in the distribution)
Additional failures relative to version 6.2.1:
failing package
reason
failure source
alexknauth-my-object
missing or broken dependency
bystroTeX
symlinks rejected
c
macro system change
cKanren
macro system change
base
command-line-ext
other incompatibile change
control
macro system change
derpy
other incompatibile change
drbayes
other incompatibile change
esc-vp21
other incompatibile change
heresy
other incompatibile change
honu
other incompatibile change
jack-mock
other incompatibile change
libscrypt
other incompatibile change
measures-with-dimensions
other incompatibile change
mischief
other incompatibile change
mischief-dev
other incompatibile change
pex
other incompatibile change
pict3d
missing or broken dependency
plt-services
other incompatibile change
honu
rackpgmp
symlinks rejected
racl
other incompatibile change
racquel
macro system change
set-exp
macro system change
unicode-properties
build timeout
Packages not in the other distribution: 2d, 2d-lib, 2d-test, class-iop-lib, deinprogramm-signature, draw-test, option-contract, option-contract-lib, option-contract-test, plai, plai-lib, unix-socket, unix-socket-lib, unix-socket-test.
Archive of packages (as available October 2015)
Catalog link: http://www.cs.utah.edu/plt/popl16/pkg-build-scopes-2015-10/archive/catalog/
With substantial effort, the build results could be reconstructed using a script like "pkg-build.rkt", which uses the "pkg-build" package. Run the script in any recent version of Racket, adjusting the #:snapshot-url, #:pkg-catalogs, and #:installer-platform-name arguments as needed. A package-build run requires additional virtual machines to isolate each package’s build. The process takes an the order of a day for a given version and catalog.