From d6baad629e9103a47c6286421f12a334a0b59fc5 Mon Sep 17 00:00:00 2001 From: Udoh Jeremiah Date: Fri, 10 Feb 2023 21:11:03 +0100 Subject: [PATCH] doc: clarify FAQ difference between "using" and "import" (#47614) Fix #43425 Co-authored-by: Allen Hill --- doc/src/manual/faq.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/src/manual/faq.md b/doc/src/manual/faq.md index 0ac53a0233402..e3960ee1a4690 100644 --- a/doc/src/manual/faq.md +++ b/doc/src/manual/faq.md @@ -818,10 +818,13 @@ to strings); similarly, `repeat` can be used instead of `^` to repeat strings. T ### What is the difference between "using" and "import"? -There is only one difference, and on the surface (syntax-wise) it may seem very minor. The difference -between `using` and `import` is that with `using` you need to say `function Foo.bar(..` to -extend module Foo's function bar with a new method, but with `import Foo.bar`, -you only need to say `function bar(...` and it automatically extends module Foo's function bar. +There are several differences between `using` and `import` +(see the [Modules section](https://docs.julialang.org/en/v1/manual/modules/#modules)), +but there is an important difference that may not seem intuitive at first glance, +and on the surface (i.e. syntax-wise) it may seem very minor. When loading modules with `using`, +you need to say `function Foo.bar(...` to extend module `Foo`'s function `bar` with a new method, +but with `import Foo.bar`, you only need to say `function bar(...` and it automatically extends +module `Foo`'s function `bar`. 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