guile-user
[Top][All Lists]
Advanced

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

Re: cannot compile: srfi-10 define-reader-ctor 'hash '#,(


From: Neil Jerram
Subject: Re: cannot compile: srfi-10 define-reader-ctor 'hash '#,(
Date: Thu, 31 Jul 2014 12:15:07 -0700
User-agent: Roundcube Webmail/0.9.5

On 2014-07-30 23:27, Jan Nieuwenhuizen wrote:
Ludovic Courtès writes:

Hi,

In this example, you want the reader extension to be available at
compile time, and not necessarily at run time. However, by writing the
code as is, the reader extension is available only at run time, hence
the error.

Alright, that makes sense when you think about it...

To require evaluation of the ‘define-reader-ctor’ form at compile time,
change the code to (info "(guile) Eval When"):

Wow, many thanks!  This works for me; would it be nice to have some of
this more explicitly in the srfi-10 manual?

This same problem just came up in another thread, too (look for "ossaulib"). In that case the thing that needed to be enclosed in an 'eval-when' form was adding a directory to the load path.

I wonder about possibly having some magic that would automatically match certain top-level forms and evaluate them at compile time. The case for this for 'define-reader-ctor' feels quite strong. For the load path case, it feels too hacky to try to recognize patterns like '(set! %load-path (append %load-path ...))', but perhaps OK if we defined an 'add-to-load-path' procedure and applied the magic to that.

What do you think?  Would that be too magical?

Regards,
     Neil




reply via email to

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