guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: modules


From: Ian Zimmerman
Subject: Re: modules
Date: 22 Mar 2004 10:05:29 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Andreas> What exactly do you want to accomplish? The point of modules is
Andreas> to isolate mostly independent code from each other, and using a
Andreas> global variable would just prevent that isolation.

This would be true if the access to the global was direct and
unrestricted.  It is not.  The setting is simply supposed to modify what
the module does when loaded.

The actual situation is this: my module internally uses a global hash
table.  This is invisible to users, except that there is no way for the
module itself to guess the table size in advance, so there has to be a
way for users to customize it.  This is pretty much the prototypical
situation where you'd use "functors" or "parametrized modules" in
languages that have them, like ML.

The workaround I am settling on is this: make the hash table a promise
(with @code{delay}) depending on a size variable, and provide an @code{init}
function to modify that variable.  It's a hack, but it works and is the
best that can be done now.

-- 
Nothing can be explained to a stone.
Or to a stoned person, either.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]