Closed galchinsky closed 12 years ago
@galchinsky it is sad that test is not in your to do list.
It's not a problem to add. I'm not familiar with the test system though
Is it ok now?
fixed
Cool. I'll test it locally. As @stepancheg said, it'd be nice to have some automated testing too. I don't know how well-suited runtests.py
is to testing the REPL; it may be better to write some standalone expect
scripts instead.
@jckarter @galchinsky program loaded with expect
will be hard to debug, I would write another clay-repl-test program written in pure C++ (in addtion to clay and claydoc binaries).
Shouldn't importedNames be a part of Module struct? loadDependent is called from repl when a new module is imported
importedNames
is redundant as part of a fully-loaded module; it's only necessary to catch and raise an error if you try to import multiple modules or symbols with the same name during load initialization, as in import foo; import bar.(a as foo);
.
But the main module can't be named 'fully-loaded' in repl. You can always load some more. If I add a pointer to importedNames what shall I send in https://github.com/galchinsky/clay/blob/orig/compiler/src/interactive.cpp#L82 ?
You're right. For the repl it makes sense to keep importedNames
as part of the Module's state.
OK, so importedNames
has to be per-loadDependents
, with a pointer passed into loadDependent
. You should be able to pass an empty set in from the REPL; by that point, the publicSymbols
and allSymbols
maps should be populated, and redundant imports should be caught.
I just didnt notice the loop in loadDep
. Fuu. Module-state works fine
Great, merged. I'll file issues for any REPL bugs I find.
Yet another try. Not much changes, but I merging becomes harder and harder, so please pull.
It seems to work with all except variant instances. Instances are needed to normal work of exceptions. Now it isn't work, so things like printer module should be load before repl starting. If you need to debug an existing module with REPL, it won't be a problem.
To do list: