[Snow-users-list] Snowflake: Snow integration with Guile module system

Julian Graham joolean at gmail.com
Tue Nov 6 23:35:38 EST 2007

Hi Schemers,

So, Snow is a wonderful idea (Guile people, go to
http://snow.iro.umontreal.ca/ right now if you haven't checked out
Snow yet), but there are some drawbacks to its approach to library
management.  Among them is the fact that it doesn't integrate with
your Scheme platform's native module system at all -- in fact, Snow
pretty much just concatenates the bodies of all of your library
implementations on load, which leads to problems with symbol name
collisions [1].  And that's kind of okay.

To get the benefit of Snow packages in, say, Guile, though, it's
necessary to make use of the encapsulation that Guile's module system
provides.  To that end, I've whipped up a small Guile module called
(snow snowflake) (because Scheme module systems are all unique, like
snowflakes!) that converts Snow packages to Guile modules and provides
a Snow-compatible mechanism for loading them.  To wit:

snow:package->module! package

...where 'package' is a string giving the name of a Snow package you
have already downloaded and installed via Snow (e.g.,
"fixnum/v1.0.3"), will copy the implementation files from
$SNOW_SITE_DIR to an appropriate subdirectory of %site-dir/snow (i.e.,
%site-dir/snow/packages/[package-name]/[package-version]) and rewrite
the package's metadata as a Guile module definition.

snow:use-modules module-list

...where 'module-list' is a list of symbols giving
(partially-specified) Snow package names -- e.g., (fixnum/v1) or
(srfi13/v1.0.0 srfi14/v1.0) -- will act as a replacement for Guile's
use-modules form, locating the right versions of packages that have
been installed in Guile's load path via snow:package->module!.  Here's
an example:

(load "snowflake.scm")
(use-modules (snow snowflake))

(snow:package->module! "fixnum/v1.0.3")
(snow:package->module! "srfi14/v1.0.1")
(snow:use-modules (srfi14/v1))

I've attached a copy of Snowflake; it works, but just barely -- you
need write access to Guile's site dir, and the code does no error
checking to speak of.  And I'm sure there are plenty of things it
doesn't get quite right, like exported syntax definitions.  Still, I
hope you guys can take a look and tell me what you think.


[1]: https://webmail.iro.umontreal.ca/pipermail/snow-users-list/2007-October/000096.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snowflake.scm
Type: text/x-scheme
Size: 6273 bytes
Desc: not available
Url : http://webmail.iro.umontreal.ca/pipermail/snow-users-list/attachments/20071106/d5cc5103/attachment.bin 

More information about the Snow-users-list mailing list