How to eliminate name conflicts between modules in Rascal?

How to avoid name conflicts between modules? From the documentation, it seems there is currently no principal name management among the modules in Rascal. When importing a module, all names declared publicin the imported module fall into the scope. Is there a way for qualified imports? Or will it be?

+4
source share
1 answer

Good question again :-). Short answer: you qualify names on usage sites in a module that has imported the same name twice.

Long answer three times:

  • The mechanism extend(as opposed to import) will support renaming for future expansion.
  • , , import , , . - ( ).
    • , : int a = f; (, f A, B), : int a = A::f int a = B::f .
  • , .
    • : data A = a(); data A = b(), syntax Exp = Exp "+" Exp; syntax Exp = Exp "*" Exp; : int f(int i) = 1; int f(real r) = 1;.
    • , : A::f(1), .
    • - , ( : int f(int i) = 1; int f(value x) = 2; .
+3

All Articles