<div dir="ltr"><div><div><div>This is a quite common pitfall into which I have myself fallen a few times, and I guess it's not the last time.<br><br></div><div>How much work would be required to prevent people from falling into it ever again?<br>
</div><div>Maybe saying so in the docs at the right place wouldn't hurt, but people may still miss it.<br></div>Maybe making the error message more specific like "Did you forget to (require (for-syntax syntax/parse)) ?" ? Or is it too specific?<br>
</div>Or pushing the idea further (and requiring more work, obviously), Racket's errors could propose a list of packages where the unknown identifier can be found, along with the require phase? Is xref able to do that currently?<br>
<br></div>Laurent<br><div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 24, 2013 at 6:20 PM, Stephen Chang <span dir="ltr"><<a href="mailto:stchang@ccs.neu.edu" target="_blank">stchang@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">You need (require (for-syntax syntax/parse)) because you are using it inside a define-syntax. </p><div class="HOEnZb">
<div class="h5">
<div class="gmail_quote">On Sep 24, 2013 11:56 AM, "Konrad Hinsen" <<a href="mailto:konrad.hinsen@fastmail.net" target="_blank">konrad.hinsen@fastmail.net</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi everyone,<br>
<br>
I am trying to learn about syntax-parse, starting with the introduction<br>
of the "Syntax" documentation.<br>
<br>
Unfortunately, the very first example given for the use of syntax-parse<br>
doesn't work in my Racket installation:<br>
<br>
Welcome to Racket v5.90.0.9.<br>
racket@> (require syntax/parse)<br>
racket@> (define-syntax (mylet stx)<br>
(syntax-parse stx<br>
[(_ ([var-id rhs-expr] ...) body ...+)<br>
#'((lambda (var-id ...) body ...) rhs-expr ...)]))<br>
stdin::277: _: wildcard not allowed as an expression<br>
in: (_ ((var-id rhs-expr) ...) body ...+)<br>
errortrace...:<br>
context...:<br>
try-next<br>
/Users/hinsen/Development/racket/pkgs/errortrace-pkgs/errortrace-lib/errortrace/errortrace-lib.rkt:480:4<br>
/Users/hinsen/Applications/Racket/collects/racket/private/misc.rkt:87:7<br>
<br>
I tried replacing the wildcard by "mylet", but that only leads to another error<br>
message:<br>
<br>
racket@> (define-syntax (mylet stx)<br>
(syntax-parse stx<br>
[(mylet ([var-id rhs-expr] ...) body ...+)<br>
#'((lambda (var-id ...) body ...) rhs-expr ...)]))<br>
stdin::842: ...: ellipses not allowed as an expression<br>
in: ...<br>
errortrace...:<br>
context...:<br>
try-next<br>
/Users/hinsen/Development/racket/pkgs/errortrace-pkgs/errortrace-lib/errortrace/errortrace-lib.rkt:480:4<br>
/Users/hinsen/Applications/Racket/collects/racket/private/misc.rkt:87:7<br>
<br>
Am I doing something wrong here? Or are the examples obsolete?<br>
<br>
Konrad.<br>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</blockquote></div>
</div></div><br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>