Next: , Previous: , Up: ref-mod   [Contents][Index]


4.11.12 Name Clashes

A name clash can arise if:

  1. a module tries to import a predicate from some other module m1 and it has already imported a predicate with the same name and arity from a module m2;
  2. a module tries to import a predicate from some other module m1 and it already contains a definition of a predicate with the same name and arity; or
  3. a module tries to define a predicate with the same name and arity as one that it has imported.

Whenever a name clash arises, a message is displayed beginning with the words ‘NAME CLASH’. The user is asked to choose from one of several options; for example,

NAME CLASH: f/3 is already imported into module user
            from module m1; 
            do you want to override this definition with
            the one in m2? (y,n,p,s,a or ?)

The meanings of the five recognized replies are as follows:

y

forget the previous definition of f/3 from m1 and use the new definition of f/3 from m2 instead.

n

retain the previous definition of f/3 from m1 and ignore the new definition of f/3 from m2.

p

(for proceed) means forget the previous definition of f/3 and of all subsequent predicate definitions in m1 that clash during the current load of m2. Instead, use the new definitions in m2. When the p option is chosen, predicates being loaded from m1 into m2 will cause no ‘NAME CLASH’ messages for the remainder of the load, though clashes with predicates from other modules will still generate such messages.

s

(for suppress) means forget the new definition of f/3 and of all subsequent predicate definitions in m1 that clash during the current load of m2. Instead, use the old definitions in m2. When the s option is chosen, predicates being loaded from m1 into m2 will cause no ‘NAME CLASH’ messages for the remainder of the load, though clashes with predicates from other modules will still generate such messages.

?

gives brief help information.



Send feedback on this subject.