wu-lang/wu

Cannot import file within the same folder, only from $WU_HOME

0xdeadbad opened this issue · 2 comments

I don't know if it's they way it is intended to be, but I expected to be able to import a file from the same folder which the file I'm compiling resides in, but instead I got an error saying that there's no such module. But, if I set $WU_HOME to a directory somewhere and copy the file I'm importing to this folder, it compiles.
Is it intended to work this way, by only importing from $WU_HOME, or is it a bug? I'll copy here some of my terminal output

garcias@PHANTOM:~/src/wu-test$ ls
font  main.wu  wumodule.wu
garcias@PHANTOM:~/src/wu-test$ wu main.wu
Compiling main.wu

wrong: no such module `wumodule`, needed either `wumodule.wu`, `wumodule/init.wu` or in `$WU_HOME`
     --> main.wu
      │
    1 │ import wumodule { ten }
      │ ^^^^^^^^^^^^^^^^^^^^^^^
  Finished things in 0ms
garcias@PHANTOM:~/src/wu-test$

main.wu

import wumodule { ten }

wumodule.wu

ten := 10

Also, neither creating a directory called wumodule and putting a init.wu inside works, only inside $WU_HOME

nilq commented

Hello, thank you for pointing this out and creating a good and thorough issue. 😄

Your example should definitely work the way you're stating. I will look into it as soon as possible; there is probably a weird edge-case priority miss-match.

nilq commented

This is now fixed 💪