If the Module does not exist yet, erase_module/1 simply succeeds.
This predicate must be used carefully since the module with all its data is erased. For this reason, an error is raised when trying to erase a module from itself (error 101).
Success: [eclipse]: module(m). [m]: [user]. :- export a/0. a :- writeln(hello). user compiled 60 bytes in 0.00 seconds yes. [m]: module(eclipse). [eclipse]: import a/0 from m. yes. [eclipse]: a. hello yes. [eclipse]: erase_module(m). yes. [eclipse]: a. calling an undefined procedure a in module eclipse Error: erase_module(M). (Error 4). erase_module(1). (Error 5). call(erase_module(mod), mod) (Error 101).