Search code examples
rascal

ModuleNameMismatch mystery


Using rascal from the command line, when I type:

import demo::hello

I receive a ModuleNameMismatch error, although the current directory (the one in which I type java -jar rascal-shell-stable.jar) contains a subdirectory named demo containing a file hello.rsc :

module hello
import IO;
void hello(){
    println("Hello word");
}

It however works when I type

import hello

and the hello.rsc is in the current directory.

For your info: I am on Windows 10.


Solution

  • The module name must be the full relative path to the module.rsc file.

    In this case, the hello.rsc file should be :

    module demo::hello
    import IO;
    void hello(){
        println("Hello word");
    }
    

    That the reason why it does work when the hello.rsc in the current directory.