[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-devel
Subject:    Re: Question: 'External references' in compiled scheme files when moving to Guile V2 from V1.8.7
From:       Andy Wingo <wingo () pobox ! com>
Date:       2011-06-22 13:46:40
Message-ID: 8739j2m11b.fsf () pobox ! com
[Download RAW message or body]

On Tue 21 Jun 2011 22:07, Ian Hulin <ian@hulin.org.uk> writes:

> My question is this:
> 	some of the .scm files in the list make references to definitions in a
> .scm file loaded previously;  When we compile this list of .scm files,
> will we need to load each .go file produced immediately after compiling
> it in order to resolve any external references, or is the byte-compiled
> code smart and defers resolving external references until such time as
> the .go file itself is loaded?

The main change is this:

  ** Functions needed by macros at expand-time need to be present at
     expand-time.

  For example, this code will work at the REPL:

    (define (double-helper x) (* x x))
    (define-macro (double-literal x) (double-helper x))
    (double-literal 2) => 4

  But it will not work when a file is compiled, because the definition of
  `double-helper' is not present at expand-time. The solution is to wrap
  the definition of `double-helper' in `eval-when':

    (eval-when (load compile eval)
      (define (double-helper x) (* x x)))
    (define-macro (double-literal x) (double-helper x))
    (double-literal 2) => 4

  See the documentation for eval-when for more information.

That's from the NEWS.  There are some other tidbits there; I recommend
reading the entire 2.0.0 NEWS entry.  It's a bit long but all the info
is there.

Regards,

Andy
-- 
http://wingolog.org/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic