Re: Macro expansion: unknown location

2014-06-15 Thread Dmitry Bogatov
* Mark H Weaver [2014-06-14 18:45:59-0400] > > Currently, Guile stores location info using a weak-key hash table, keyed > > on the datums read from the file. This means that location info cannot > > be stored for bare symbols or other immediate values (booleans, > > characters, small exact intege

Re: Macro expansion: unknown location

2014-06-14 Thread Mark H Weaver
Mark H Weaver writes: > Currently, Guile stores location info using a weak-key hash table, keyed > on the datums read from the file. This means that location info cannot > be stored for bare symbols or other immediate values (booleans, > characters, small exact integers). Symbols are not immedi

Re: Macro expansion: unknown location

2014-06-14 Thread Mark H Weaver
l...@gnu.org (Ludovic Courtès) writes: > A workaround is to get location info from the outer syntax object ‘x’: > > (define-syntax zero! > (lambda (x) > (syntax-case x () > ((_ var) >(begin >(unless (identifier? #'var) > (syntax-violation 'zero! "identifier exp

Re: Macro expansion: unknown location

2014-06-11 Thread Ludovic Courtès
A workaround is to get location info from the outer syntax object ‘x’: --8<---cut here---start->8--- (define-syntax zero! (lambda (x) (syntax-case x () ((_ var) (begin (unless (identifier? #'var) (syntax-violation 'zero! "i

Macro expansion: unknown location

2014-06-10 Thread Dmitry Bogatov
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

Re: Way to control the order of macro expansion

2014-01-02 Thread Panicz Maciej Godek
It turned out, that the above solution doesn't work exactly as expected -- since the scopes of "private" and "interface" get separated (by the with-syntax form that I have been so proud of), it is impossible for the public forms to refer to private bindings. To solve that issue, I had to pass the

Re: Way to control the order of macro expansion

2014-01-02 Thread Chris Vine
On Thu, 2 Jan 2014 15:30:32 +0100 Panicz Maciej Godek wrote: > After reading some of the original paper by Dybvig[1], > I finally managed to get the macro right. The trick > was to use "with-syntax", which -- I have to admit > -- is still a little magical to me. But by mimicking > the way the proc

Re: Way to control the order of macro expansion

2014-01-02 Thread Panicz Maciej Godek
After reading some of the original paper by Dybvig[1], I finally managed to get the macro right. The trick was to use "with-syntax", which -- I have to admit -- is still a little magical to me. But by mimicking the way the procedure "generate-temporaries" has been used in the Dybvig's implementatio

Way to control the order of macro expansion

2014-01-01 Thread Panicz Maciej Godek
Hi, is there any way to control the order of macro expansion? Let's consider a particular problem. I'm trying to write a macro to control the visibility of certain definitions. I wrote it once, using define-macro, but it seemed to loose some relevant information, so I decided to rewrit

Re: Macro expansion

2011-01-16 Thread Hans Aberg
On 15 Jan 2011, at 21:39, Neil Jerram wrote: With my current Guile, scheme@(guile-user)> (version) $4 = "1.9.14.17-44f43" the third case behaves as you would expect: When I upgrade, then it too works. So it was a bug that has been fixed, then. scheme@(guile-user)> (version) $1 = "1.9.14.

Re: Macro expansion

2011-01-15 Thread Hans Aberg
On 15 Jan 2011, at 21:39, Neil Jerram wrote: With my current Guile, scheme@(guile-user)> (version) $4 = "1.9.14.17-44f43" the third case behaves as you would expect: That is right, I used the stable versions 1.8.x, x = 7, 8. Unfortunately, when I try to install guile-1.9.14, I get the err

Re: Macro expansion

2011-01-15 Thread Neil Jerram
Hans Aberg writes: > In the code below the 'loop' and 'begin' examples will execute the > while' loop, but if put into the body of a function, 'while' will not > run. So why, and how to fix it? > > Just copy and paste the examples below into guile. For the two first, > I get > 0123456789 > 01

Macro expansion

2011-01-11 Thread Hans Aberg
In the code below the 'loop' and 'begin' examples will execute the 'while' loop, but if put into the body of a function, 'while' will not run. So why, and how to fix it? Just copy and paste the examples below into guile. For the two first, I get 0123456789 0123456789done!3 but for the