chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Autoloading optional dependencies


From: Alaric Snell-Pym
Subject: [Chicken-users] Autoloading optional dependencies
Date: Sat, 11 Sep 2010 10:03:56 +0100
User-agent: Mozilla/5.0 (X11; U; NetBSD amd64; en-US; rv:1.9.1.9) Gecko/20100520 Lightning/1.0b2pre Shredder/3.0.4


Hi there folks

I've noticed that the autoload egg goes partway towards solving Ugarit's
"depends on EVERY hash, compression, and encryption egg" problem.

For those not familiar with it, the principle is that I can write:

(autoload z3 z3:encode-buffer z3:decode-buffer)

...and only if I actually use the z3:encode-buffer or z3:decode-buffer
functions *at run time* will there be an attempt to load z3.so.

This means I can remove all the hash, compression, and encryption eggs
from the "needs" declaration in ugarit.meta, making it easy to install,
but the user needs to install (eg) z3 if they want to actually enable
deflate compression in their Ugarit configuration. But they needn't
install things they don't actually use.

Obviously, eggs which export syntax aren't eligible for such magic, but
after all, how could a syntax egg be optional at run-time anyway?

This isn't a *complete* solution since it still means Ugarit needs to
know about all the hash, compress, and encryption eggs it might need,
meaning that Ugarit needs updating every time somebody adds a new one -
and any other apps in a similar situation to Ugarit will also need
updating. So I'd still like a dynamic plugin registry one day ;-)

Anyway, my point is this: I feel a bit dirty not declaring the
"optional" eggs *at all* in ugarit.meta. Therefore, I propose the use of
an "optional" declaration therein, like so:

 (optional lzma z3 tiger-hash sha2 aes)

...purely to document which other eggs it *can* take advantage of if
they are available. Whether chicken-install does something with this
information one day is open to debate - my hunch would be to wait and
see if any other eggs adopt this "design pattern", and if so, decide
then what would be a good approach.

ABS

--
Alaric Snell-Pym
http://www.snell-pym.org.uk/alaric/



reply via email to

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