thanks - the accidental bug explanation makes everything clear (and yes, that was the question). cheers, andrew
On Tuesday, 7 July 2015 17:14:32 UTC-3, Leah Hanson wrote: > > I think his summary in #11031 is accurate, and the reason given directly > in the reply is the reason for using/importall to be different. Issue #8000 > is a discussion of ways to change/simplify the syntax. > > I'll take a stab at rephrasing the different in case that helps. There is > only one difference, and on the surface (syntax-wise) it may seem very > minor. The difference between "using" and "importall" is that with "using" > you need to say "function Foo.bar(.." to extend module Foo's function bar > with a new method, but with "importall" or "import Foo.bar", you only need > to say "function bar(..." and it automatically extends module Foo's > function bar. > > If you use "importall", then "function Foo.bar(..." and "function bar(..." > become equivalent. If you use "using", then they are different. > > The reason this is important enough to have been given separate syntax is > that you don't want to accidentally extend a function that you didn't know > existed, because that could easily cause a bug. This is most likely to > happen with a method that takes a common type like string or int, because > both you and the other module could define a method to handle such a common > type. If you use importall, then you'll replace the other module's > implementation of "bar(s::String)" with your new implementation, which > could easily do something complete different (and break all/many future > usages of the other functions in module Foo that depend on calling bar). > > Does this make more sense to you? > (And is it an answer to the question you were asking, or did I > misunderstand?) > > Best, > Leah > > On Tue, Jul 7, 2015 at 9:05 AM, andrew cooke <[email protected] > <javascript:>> wrote: > >> >> i'm trying to understand the difference between "using" and "importall". >> i have the same confusion described at >> https://github.com/JuliaLang/julia/issues/11031 but, unlike the OP >> there, reading https://github.com/JuliaLang/julia/issues/8000 had not >> clarified things for me. >> >> thanks, >> andrew >> >> >
