eric-hawthorne / relish

Automatically exported from code.google.com/p/relish
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Methods defined only in imported pkgs should not be callable by unqualified name #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If a method of a given name is not defined in the current package source code, 
but is defined in at least one directly imported package, then the method 
should be callable in source code in the current package, but only if qualified 
by the local-in-file name/alias of the imported package. 

Currently, such methods are callable with no name qualification, because the 
multimethod exists in the current package's Multimethods table. Also, 
currently, methods which exist only in indirectly imported packages are also 
callable by unqualified name currently and should not be callable at all.

Note that a method name might exist in multiple directly imported packages. In 
this case, the method has to be callable by either qualified name. And we have 
to decide whether to switch to using the designated imported package's 
MultiMethods table. Probably should.

Original issue reported on code.google.com by relis...@gmail.com on 2 Nov 2012 at 11:39

GoogleCodeExporter commented 9 years ago
Fixed by changing how multimethod tables propagate from package to dependent 
package. The fix does not do exactly what is mentioned in the bug report. You 
do not package-qualify the name of the method from a directly imported package, 
because dynamic dispatch needs to work, choosing between method implementations 
from different packages. However, you can no longer access a method from an 
indirectly imported package. 

Original comment by relis...@gmail.com on 19 Dec 2012 at 7:02