guile-user
[Top][All Lists]
Advanced

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

Re: Strange error from %search-load-path via include-from-path when par


From: Andy Wingo
Subject: Re: Strange error from %search-load-path via include-from-path when parameter is not a literal string
Date: Mon, 17 Oct 2011 23:36:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Hi,

On Mon 17 Oct 2011 20:20, Ian Hulin <address@hidden> writes:

> I'm trying to write a V2/V1 compatible function like the following:
>
> (define (ly:include the-file)
>   (if (string>? (version) "1.9.10")
>       (include-from-path the-file)
>       (load-from-path the-file)))
>
> I get
> ERROR in procedure %search-load-path: Wrong type to apply in position
> 1 (expecting string): the-file.
>
> Bug or user error?

User error, unfortunately.  `include' is a macro that expects a literal
string, not a procedure that expects an expression that evaluates to a
string.  For this to work, ly:include would also need to be a macro.

How about:

  (cond-expand
    (guile-2
     (define-syntax ly:include
       (syntax-rules ()
         ((_ the-file) (include-from-path the-file)))))
    (else
     (define (ly:include the-file)
       (load-from-path the-file))))

Assuming of course that you really need it to be ly:include.  The
portable (1.8/2.0) option is to use modules instead of load-from-path.

Regards,

Andy
-- 
http://wingolog.org/



reply via email to

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