You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently load student source files and the reference source file into the same interaction-environment. This is terrible. It loads two files that should be isolated into the same namespace. Student source files have access to the testing functions (such as REF-bool-equal?) and answer/reference functions (through delay).
We currently solve the second issue with testOutputTransform, but there should be a better solution using environment manipulation to separate namespaces.
From some searching online, it looks like:
We can use (scheme-report-environment 5) to get a new namespace with only R5RS definitions inside of it. (It does not inherit definitions defined in the current scope.)
The second argument of eval allows us to run code within a specified namespace.
Unfortunately the plt-r5rs implementation of load doesn't contain a second argument to load a file into a specific namespace. But we can workaround this by composingeval and load.
This only gets us halfway though. Since the load portion is ran within a new environment, the definitions properly get defined in that restricted namespace. But since the filename is in the current scope, that load expression no longer has access to the variable containing the filename. So one of the challenges here is retaining dynamic file loading. Perhaps there's a way to copy a definition into this new namespace, but I haven't found it yet.
The text was updated successfully, but these errors were encountered:
We currently load student source files and the reference source file into the same
interaction-environment
. This is terrible. It loads two files that should be isolated into the same namespace. Student source files have access to the testing functions (such asREF-bool-equal?
) and answer/reference functions (throughdelay
).We currently solve the second issue with
testOutputTransform
, but there should be a better solution using environment manipulation to separate namespaces.From some searching online, it looks like:
(scheme-report-environment 5)
to get a new namespace with only R5RS definitions inside of it. (It does not inherit definitions defined in the current scope.)eval
allows us to run code within a specified namespace.plt-r5rs
implementation ofload
doesn't contain a second argument to load a file into a specific namespace. But we can workaround this by composingeval
andload
.The text was updated successfully, but these errors were encountered: