[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unhandled constant?
From: |
Han-Wen Nienhuys |
Subject: |
Re: unhandled constant? |
Date: |
Thu, 30 Jan 2020 09:05:17 +0100 |
[guile1.8]$ grep -ir define-syntax-rule .
(empty)
I need something that works in GUILE 1.8 too.
this is what I got from David Kastrup:
>Got any comments about macros being sooo yesterday compared to syntax
forms? Syntax forms actually don't work in LilyPond: there was an
incompatibility because the 1.8 implementation will balk if some symbol
used in syntax forms already has a definition, and we have that. I
forgot the exact symbol at fault. I think it was some music function
name.
Would there be a way that we can use our source code unchanged with GUILE 2.2?
Can you explain why I get this error message?
On Wed, Jan 29, 2020 at 4:06 PM Ricardo Wurmus <address@hidden> wrote:
>
>
> Han-Wen Nienhuys <address@hidden> writes:
>
> > Some of the lilypond Scheme files do the following:
> >
> >
> > (define decl '())
> > (define (make-var n v) (list "var" n v))
> > (defmacro define-session (name value)
> > (define (inner n v)
> > (set! decl
> > (cons
> > (make-var n v)
> > decl))
> > )
> > `(,inner ',name ,value))
> > (define-session foo 1)
> > (display decl)
> > (newline)
> >
> > In GUILE 2.2, this yields
> >
> > ;;; WARNING: compilation of /home/hanwen/vc/lilypond/q.scm failed:
> > ;;; unhandled constant #<procedure inner (a b)>
> >
> > What does this error message mean, and what should I do to address the
> > problem?
>
> Would it be feasible to use define-syntax-rule here?
>
> --8<---------------cut here---------------start------------->8---
> (define decl '())
> (define (make-var n v) (list "var" n v))
> (define-syntax-rule (define-session name value)
> (let ((inner (lambda (n v)
> (set! decl
> (cons
> (make-var n v)
> decl)))))
> (inner 'name value)))
> (define-session foo 1)
> (display decl)
> (newline)
> --8<---------------cut here---------------end--------------->8---
>
>
> --
> Ricardo
--
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen