From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Hulin Newsgroups: gmane.lisp.guile.user Subject: Re: Strange error from %search-load-path via include-from-path when parameter is not a literal string Date: Wed, 19 Oct 2011 15:43:39 +0100 Message-ID: <4E9EE21B.3080803@hulin.org.uk> References: <877h439u78.fsf@pobox.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1319035442 29117 80.91.229.12 (19 Oct 2011 14:44:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 19 Oct 2011 14:44:02 +0000 (UTC) Cc: guile-user@gnu.org To: Andy Wingo Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Oct 19 16:43:57 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RGXN5-0003ry-MU for guile-user@m.gmane.org; Wed, 19 Oct 2011 16:43:55 +0200 Original-Received: from localhost ([::1]:47578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGXN5-00051i-6K for guile-user@m.gmane.org; Wed, 19 Oct 2011 10:43:55 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:58363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGXMw-00050c-B2 for guile-user@gnu.org; Wed, 19 Oct 2011 10:43:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGXMv-0001tE-1r for guile-user@gnu.org; Wed, 19 Oct 2011 10:43:46 -0400 Original-Received: from asmtp1.iomartmail.com ([62.128.201.248]:39359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGXMu-0001o8-Ph for guile-user@gnu.org; Wed, 19 Oct 2011 10:43:45 -0400 Original-Received: from asmtp1.iomartmail.com (localhost.localdomain [127.0.0.1]) by asmtp1.iomartmail.com (8.13.8/8.13.8) with ESMTP id p9JEheSK030784; Wed, 19 Oct 2011 15:43:40 +0100 Original-Received: from [192.168.1.100] (cpc13-rdng21-2-0-cust334.15-3.cable.virginmedia.com [82.12.149.79]) (authenticated bits=0) by asmtp1.iomartmail.com (8.13.8/8.13.8) with ESMTP id p9JEheDQ030771; Wed, 19 Oct 2011 15:43:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 Original-Newsgroups: gmane.lisp.guile.user In-Reply-To: <877h439u78.fsf@pobox.com> X-Enigmail-Version: 1.3.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 62.128.201.248 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8900 Archived-At: Hi Andy and Mark, Many thanks for the info. Also thanks for the catch re using modules and portability, I'll have to address the issue of the tidying up what definitions need to be loaded into the main (lily) module from other files, and which of those need to be modules, which was work I had been hoping to defer :-{. Cheers, Ian Hulin On 17/10/11 22:36, Andy Wingo wrote: > Hi, > > On Mon 17 Oct 2011 20:20, Ian Hulin 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