unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Ian Hulin <ian@hulin.org.uk>
Cc: guile-user@gnu.org
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	[thread overview]
Message-ID: <877h439u78.fsf@pobox.com> (raw)
In-Reply-To: <j7hrlt$p39$1@dough.gmane.org> (Ian Hulin's message of "Mon, 17 Oct 2011 19:20:45 +0100")

Hi,

On Mon 17 Oct 2011 20:20, Ian Hulin <ian@hulin.org.uk> 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	other threads:[~2011-10-17 21:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-17 18:20 Strange error from %search-load-path via include-from-path when parameter is not a literal string Ian Hulin
2011-10-17 21:36 ` Andy Wingo [this message]
2011-10-19 14:43   ` Ian Hulin
2011-10-17 21:54 ` Mark H Weaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877h439u78.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-user@gnu.org \
    --cc=ian@hulin.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).