[Nickle] Artificial distinction between import and autoimport
bart at po8.org
Fri Feb 1 19:41:04 PST 2008
These keywords need clear documentation.
load filename: brings an arbitrary file into memory
import namespace-name: brings the contents of the given namespace,
which must already be in memory, into scope
autoload namespace-name: checks to see if the given namespace is already in
memory. if not, constructs a filename from the
namespace name, tries to find this filename on disk, and if
found, loads it, regardless of its contents.
autoimport namespace-name: checks to see if the given
namespace is already in memory. if not, autoload the given
namespace. then import the given namespace. "autoimport" is
semantically equivalent to "autoload and then import".
In a Nickle program intended to be invoked externally, you'd
typically just say
autoimport Socket, File, Process;
and be happy when these namespaces were imported from
wherever it is they came from.
If you're typing around debugging your namespace from the
Nickle prompt, though, autoimport doesn't do what you want
at all after the first time, because autoload doesn't. You
might start your session with
but if you change ns.5c you'd better type
or you'll not bring your changes into memory and then into
We could add a command that was
or somesuch to combine these actions---if anyone cared.
Hope that clarifies the confusion, and that there's no need
for change now. If not, let me know.
In message <873ascupxg.wl%cworth at cworth.org> you wrote:
> So I started writing a nickle program today[*] and ended up with the
> following code:
> import Socket;
> import File;
> autoimport Process;
> I contend that the distinction of "core" namespaces like Socket and
> File and "non core" namespaces like Process is arbitrary and totally
> uninteresting to the user. So forcing the user to remember which is
> which is just not nice.
> Keith explains that the distinction comes down to whether the core of
> nickle uses the namespace or not, (and there's actually a desire to
> keep the core as small as possible so that nickle can load fast). So
> there's even the potential for namespaces to move from core to
> non-core. Again, not nice for the user.
> So Keith says "There's no harm in autoloading a core namespace, why
> don't you just do that?". But if I'm going to always type "autoload"
> for all namespaces, why don't we just settle on the "import" name and
> make it do exactly what autoimport does today.
> Bart, I'm informed that this all takes place in fairly twisty passages
> of the implementation, and that you are likely to be much more
> successful at finding your way through them than I am. Care to take a
> whack at it?
More information about the Nickle