Re: with-syntax return error in Guile, not in Kawa or Racket
Jean Abou Samra <[email protected]>
| Newsgroups | gmane.lisp.guile.user |
|---|---|
| Message-ID | <[email protected]> |
> the problem when pre-compiling/pre-computing those lists is that with #' ,
> i mean syntax, the optimizer-parse-square-brackets-arguments-lister no
> more receive lists but this sort of expression:
>
> scheme@(guile-user)> (define T (make-vector 7))
> scheme@(guile-user)> {T[2 + 1] <- 7}
> <- : #'(index ...) = (#<syntax:unknown file:3:3 2> #<syntax:unknown file:3:5 +> #<syntax:unknown file:3:7 1>)
> <- : (syntax->datum #'(index ...)) = (2 + 1)
> optimizer-parse-square-brackets-arguments-lister : args-brackets=(#<syntax:unknown file:3:3 2> #<syntax:unknown file:3:5 +> #<syntax:unknown file:3:7 1>)
Yes, these are wrapped syntax objects.
> my question is how to deal with that?
There are a variety of tools to work with syntax objects, just like
there are tools to work with lists. Among them: syntax (#'),
quasisyntax (#`), unsyntax (#,), unsyntax-splicing (#,@),
identifier?, free-identifier=?, bound-identifier=?, and of
course syntax-case.
> becaue in the parser i check ,for example for + being '+ not some sort of #<syntax:unknown file:3:5 +>
> i suppose the problem come from here
> should i modify the parser to check for #'+ #'- #'* #'/ #'expt #'and #'or etc... or is there something to do when i pass arguments in the macro?
Use (free-identifier=? the-identifier #'+)
> also i pass #'(index ...) creating a sort of ( ) list ,how to pass th index and ellipsis in a syntax form ?? should i put that in a list with list procedure?
#'(index ...) is a traditional list (not a wrapped syntax object), so you
can work with it directly (its elements are wrapped syntax objects).
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSZ7TKxnKGyBvBjzBmj8PYLiTOX/gUCZj/DnwAKCRCj8PYLiTOX /gX8AQD80j7grxGvXX6uKh1wWukkF6VM9u02Qji0lmL17527tAEA40bbd8X765ah SlC1xZRzyvOlFSIsItHyhD2WojULTgU= =nEQz -----END PGP SIGNATURE-----