Closed dram closed 8 years ago
What if you just do this in the library:
define library main
use dylan;
use io;
end;
Then will be another error:
error: Unknown module format-out in library main
The problem is that there is no module defined in io
library, after adding an empty module, the problem disappeared.
The deeper cause is that for every library, for first time complete_library
is called, it will call load_library
, and then define_module
. In define_module
library will be checked again for its completeness, then complete_library
will be call again.
If there is no module in library, define_module
will not be called, and library will be leave as uncompleted.
Great work!
It looks like many things currently call complete_library
and it isn't clear to me if that's the nature of the design and intentional or whether the design is moderately clumsy and so it needs to be called from lots of places. :)
But either way, since it is called many times, perhaps this current behavior is just an oversight and can be fixed by finding the right place to insert a new check to see if the library is completed, and if not, then to complete it?
complete_library
already calls complete_library
on each of the libraries that it uses. Maybe there's an error in the logic there?
Yes, I think complete_library
is quite confusing.
I made a possible fix, calling complete_library
and also complete_module
in fop_done
, which I think is more reasonable, doing completion at end of definition, instead of before using it. see here: https://github.com/dram/mindy/commit/f721f579ff055150458e1150eaebdf83b7453920
Have not read through Mindy's interpreter code yet, not sure if it will cause other problems, and I also not satisfied with that patch, so do not send pull request yet.
Although code reading is not finished yet, I'm kind of satisfied with this new fix, so I send a pull request for review.
When trying to use
format-out
module fromio
library with following code:Mindy refused to run with following error:
What becomes interesting is that when I specifing
io-lib.dbc
explicitly, it runs correctly: