Import koka code from elsewhere on your system through symlink
chtenb opened this issue · comments
Discussed in #439
Originally posted by chtenb January 17, 2024
Is it possible to import koka code from some other directory elsewhere on your file system? Using the import
keyword with paths (relative or absolute) does not seem to work, at least on windows. I tried creating a symbolic link, which almost seems to work, but then still absolute paths end up in the kki file, like this:
module interface c:/Users/username/prj/kklib/util
with the error prj_kklib_util.kki(1,19): error: invalid syntax
I just pushed an initial fix for this (commit f58c61f) (although we need to think a bit more about this in context of packages.).
When loading a file that is either not relative to the include path roots, or has invalid directory names up-to the include path, in such case we only keep the declared module name in the source.
(However, that also means the compiler cannot find such modules unless referred to relatively since the connection to the file path is broken -- however, I think this is not a problem in practice since loading such files can only be done explicitly by the user anyways. )