A summary of the main difference, in a way that I find easy to remember:
using NiceStuff
allows usage access to exported names without the module qualifier, which import NiceStuff
doesn't; and
import NiceStuff: nice
allows extension access (adding methods) to the specified function without the module qualifier, which using NiceStuff: nice
doesn't.
And a minor difference:
X as Y
syntax is allowed for individual identifiers with both using
and import
(using Random: randstring as rstr
, import Random: randstring as rstr
) but for the module name itself, import Random as Rnd
is allowed while using Random as Rnd
is an error.
Some other points I found useful from the Modules docs page
using ModuleName
is the only form for which export lists matter at all.
import NiceStuff
is equivalent to using NiceStuff: NiceStuff
.