* bug#10992: error signaled for syntax expression
@ 2012-03-11 13:23 Stefan Israelsson Tampe
2012-03-11 17:25 ` Mark H Weaver
2012-03-18 21:11 ` bug#10992: patch and fixed test Stefan Israelsson Tampe
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Israelsson Tampe @ 2012-03-11 13:23 UTC (permalink / raw)
To: 10992
[-- Attachment #1.1: Type: text/plain, Size: 274 bytes --]
Hi,
I wanted to enter meta data where the symbols are important into a syntax
object and tried to be smart
in doing that but stumbled on this because loading (a simplified example)
the attached file I get an annoying error e.g.
ERROR: bad src
$7 = #(a (a b) (a (b c) #f))
[-- Attachment #1.2: Type: text/html, Size: 403 bytes --]
[-- Attachment #2: stx-bug.scm --]
[-- Type: text/x-scheme, Size: 438 bytes --]
(eval-when (compile load eval)
(define (syntax->list x)
(syntax-case x ()
((x . l) (cons #'x (stx->list #'l)))
(() '()))))
(eval-when (compile load eval)
(define (my-datum->syntax stx l)
(datum->syntax
stx
(map (lambda (x) `(quote ,x)) l))))
(define q 1)
(define-syntax f
(lambda (x)
#`(vector #,@(my-datum->syntax #'q
'(a (a b) (a (b c) #f))))))
(f 1)
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#10992: error signaled for syntax expression
2012-03-11 13:23 bug#10992: error signaled for syntax expression Stefan Israelsson Tampe
@ 2012-03-11 17:25 ` Mark H Weaver
2012-03-18 21:11 ` bug#10992: patch and fixed test Stefan Israelsson Tampe
1 sibling, 0 replies; 3+ messages in thread
From: Mark H Weaver @ 2012-03-11 17:25 UTC (permalink / raw)
To: Stefan Israelsson Tampe; +Cc: 10992-done
Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:
> Hi,
>
>
> I wanted to enter meta data where the symbols are important into a
> syntax object and tried to be smart
> in doing that but stumbled on this because loading (a simplified
> example) the attached file I get an annoying error e.g.
>
> ERROR: bad src
> $7 = #(a (a b) (a (b c) #f))
Fixed in 30398e94f9cadfaff44117bbff214b0b7ba703ca.
Thanks!
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#10992: patch and fixed test
2012-03-11 13:23 bug#10992: error signaled for syntax expression Stefan Israelsson Tampe
2012-03-11 17:25 ` Mark H Weaver
@ 2012-03-18 21:11 ` Stefan Israelsson Tampe
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Israelsson Tampe @ 2012-03-18 21:11 UTC (permalink / raw)
To: 10992
[-- Attachment #1.1: Type: text/plain, Size: 654 bytes --]
Racket has two versions of syntax-local-binding, one that does lookup of
syntax parameters and one that don't. So it would be interesting to know
why.
Anyway with this mail, there is a patch that enable syntax-local-value to
lookup syntax-parameters
as well.
Also let's fix the test. With the definitions as in the previous mail use
in stead,
(define-syntax info
(lambda (x)
(syntax-case x ()
((_ f)
(let-values (((key ret) (syntax-local-binding #'f)))
(datum->syntax x (eq? ret %f)))))))
and
(info f) => #t
(fluid-let-syntax ((f (lambda x #'#t))) (info f)) => #f
[-- Attachment #1.2: Type: text/html, Size: 772 bytes --]
[-- Attachment #2: resolve-identifier.patch --]
[-- Type: text/x-patch, Size: 1193 bytes --]
From 847991d6424ab99009a632bf7561392c52e7704d Mon Sep 17 00:00:00 2001
From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
Date: Sun, 18 Mar 2012 22:08:39 +0100
Subject: [PATCH] module/ice-9/psyntax.scm (resolve-identifier): enable
syntax-local-value to lookup syntax-parameters.
---
module/ice-9/psyntax.scm | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm
index 6015eff..4f71764 100644
--- a/module/ice-9/psyntax.scm
+++ b/module/ice-9/psyntax.scm
@@ -843,6 +843,13 @@
(values (binding-type b) (binding-value b) mod)))
(let ((n (id-var-name id w)))
(cond
+ ((assq n r) => (lambda (pb)
+ (let ((b (cdr pb)))
+ (values (binding-type b)
+ (binding-value b)
+ (if (syntax-object? id)
+ (syntax-object-module id)
+ mod)))))
((symbol? n)
(resolve-global n (if (syntax-object? id)
(syntax-object-module id)
--
1.7.9
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-18 21:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-11 13:23 bug#10992: error signaled for syntax expression Stefan Israelsson Tampe
2012-03-11 17:25 ` Mark H Weaver
2012-03-18 21:11 ` bug#10992: patch and fixed test Stefan Israelsson Tampe
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).