On Sunday, April 26, 2015 at 10:12:51 AM UTC+10, Scott Jones wrote: > > The compiler can't determine that there are no conflicts in the case where > the method uses a type that is local to the module? >
That is not a sufficient condition, a function of the same name which uses ::Any in the same parameter position can conflict IIUC. > That is the *only* case where I am saying that it should not be necessary > to have an "import Base.bar" or "import Foo.bar" if I > want to export a function and have it available at a higher level, and not > have to worry that later on somebody adding bar to Base > or Foo will cause my module to stop working? > As the module writer you have no control over how your module is used, you shouldn't be trying to enforce that your functions don't conflict since that implies a knowledge of the uses of your module. The user of your module is the only one that knows which function they mean, they have to tell the compiler, not you. > What if I had a getsockname function? ;-) > That name was just added to Base tonight apparently... so my code would > break... > Not good! > It should break, the compiler cannot in general know if there are no conflicts, and IIUC *cannot even know if it can determine it efficiently*. Yes you can give examples where it would safely work, but if the compiler cannot check that without potentially entering an expensive computation, then it simply cannot check at all. > > > On Saturday, April 25, 2015 at 7:49:33 PM UTC-4, [email protected] wrote: >> >> I think the key issue is your: >> >> >>> I believe they should be able to use both, as long as there aren't any >>> real conflicts, *without* spurious warnings... >>> >> >> As Jeff said, the problem is "aren't any real conflicts" is not possible >> to determine in all cases, and can be costly in others. And IIUC its not >> possible to know ahead of time if it can be determined. >> >> So because its not practically possible to protect against problematic >> situations, Julia plays it safe and complains about all situations. >> >> Cheers >> Lex >> >
