Re: [Chicken-users] Autoloading optional dependencies

2010-09-11 Thread Peter Bex
On Sat, Sep 11, 2010 at 10:03:56AM +0100, Alaric Snell-Pym wrote:
> 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.

Well, go ahead and add it :)

(chicken-install already ignores unknown meta declarations)

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
-- Donald Knuth

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Autoloading optional dependencies

2010-09-11 Thread Alaric Snell-Pym


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/

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users