This built-in predicate creates a unique module name (second parameter) from the specified filename (first parameter) that is a valid atom. Characters in the filename that are invalid atomic characters are replaced by an underscore character.
see also: active_module/1 check_singleton/1 close_all_modules/0 close_module/1 consult/0 consult/1 create_module/1 create_module/2 ensure_loaded/1 include/1 module/3 modules open_module/0 open_module/1 open_module/3 open_module_search/3 open_standard_module/2 save_module/1 save_module/2 save_module/3 set_active_module/0 set_active_module/1 this_module/3
| Examples | |
| module_name("c:\\temp\\st23.txt", N). | the variable N is unified with the atom 'st23' N=st23 |
| module_name("c:\\temp\\st23.txt", st35). | the call fails because the atom 'st23' cannot be unified with the value of the second parameter |
| Exceptions | |
| first argument is an empty variable | an instantiation_error exception is thrown |
| one or both of the arguments are not an atom | type_error(atom, A) |