chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] .csirc - recover from attempt to (use) a non-existant eg


From: Erik Falor
Subject: [Chicken-users] .csirc - recover from attempt to (use) a non-existant egg
Date: Fri, 14 Mar 2014 15:01:31 -0600
User-agent: Mutt/1.5.22 (2013-10-16)

I have a reasonably complex .csirc in which I (use) several eggs.
Whenever I copy my .csirc onto a new machine I always have to spend a
few minutes commenting large swaths of it out because I haven't yet
chicken-installed all of the requisite eggs.  It's annoying enough
that I tried to let the code sort it out for me.  However, my naive
attempt crashes and burns because I can't get Chicken to avoid
expanding the (import ...) form.

What I'm trying to do amounts to this:

(handle-exceptions exn
  (print "chicken-doc hasn't been installed!")
  (require chicken-doc)
  (import chicken-doc))

But the import happens in such a way that I cannot avoid it even in
the face of the (require ...) form failing.

% csi -:a5

Error: (import) during expansion of (import ...) - cannot import from undefined 
module: chicken-doc

        Call history:

        <syntax>          (##sys#call-with-values (##core#lambda () (require 
chicken-doc) (import chicken-doc)) (##core#lambda......
        <syntax>          (##core#lambda () (require chicken-doc) (import 
chicken-doc))
        <syntax>          (##core#begin (require chicken-doc) (import 
chicken-doc))
        <syntax>          (require chicken-doc)
        <syntax>          (import chicken-doc)  <--


I suppose this is because (require ...) happens at runtime and
whatever (import ...) does happens when the syntax is expanded.

Is there a clean way to achieve the effect of reporting a missing egg
with an error message (and leaving my interpreter otherwise usable)?

-- 
Erik Falor
Registered Linux User #445632                  http://linuxcounter.net

Attachment: pgpkFYMeoe0lO.pgp
Description: PGP signature


reply via email to

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