guile-user
[Top][All Lists]
Advanced

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

Macro expansion: unknown location


From: Dmitry Bogatov
Subject: Macro expansion: unknown location
Date: Wed, 11 Jun 2014 00:16:38 +0400
User-agent: Mutt/1.5.22.1 (2013-10-16)

Hello!

Here is very simple code with error (lines numbered with `cat -n`)

     1  ;(read-enable 'copy)
     2
     3  (define-syntax zero!
     4    (lambda (x)
     5      (syntax-case x ()
     6        ((_ var)
     7         (begin
     8           (unless (identifier? #'var)
     9             (syntax-violation 'zero! "identifier expected" #'var))
    10           #'(set! var 0))))))
    11
    12  (zero! #f)

Trying to run or compile it of course leads to error, but it says
nothing about offending expression.

        ice-9/boot-9.scm:106:20: In procedure #<procedure e1f4c0 at 
ice-9/boot-9.scm:97:6 (thrown-k . args)>:
        ice-9/boot-9.scm:106:20: Syntax error:
        unknown location: zero!: identifier expected

In this example `syntax-violation` is not actually needed, guard would
suffice. But if guard fails, I get "do not match pattern error" without
any clues what expectation I violated, and I found myself writing macros
compicated enough, that I want detailed description.

(read-enable 'positions) did not helped.
(read-enable 'copy) (commented line 1) cause Guile to hang.
When called from repl (load "foo.scm") repl hangs and do not respond
to ^C.

guile (GNU Guile) 2.0.9
Linux localhost 3.14.0-gnu #8 SMP Sat Apr 12 11:56:49 MSK 2014 x86_64 Intel(R) 
Core(TM) i7 CPU Q 740 @ 1.73GHz GenuineIntel GNU/Linux

Any suggestions or workarounds?

--
Best regards, Dmitry Bogatov <address@hidden>,
Free Software supporter, esperantisto and netiquette guardian.
        git://kaction.name/rc-files.git
        GPG: 54B7F00D

Attachment: pgpZXj8HXuoy7.pgp
Description: PGP signature


reply via email to

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