[Prev][Next][Index][Thread]
Re: definer macros
neelk@alum.mit.edu (Neelakantan Krishnaswami) wrote in message news:<slrn9ke1ai.jq7.neelk@brick.cswv.com>...
> Try changing
>
> { define responder ?:name = ?uri:expression
>
> to
>
> { define responder ?:name ?equal:token ?uri:expression
>
> While what you wrote looks like it should be legal according to the
> BNF, but I've noticed that GD sometimes has obscure troubles whenever
> the '=' token is used in a macro definition. Try changing the
> definition to accept any token there and see if it works -- if it does
> you can just write your macro calls with '='.
It doesn't seem to fix it. (Not sure if it makes any difference, but
this is in FunDev.)
In the end I changed the syntax to something a little more extensible
anyway, since there might be additional args to
register-response-function in the future. But I'm still curious as to
why my original syntax doesn't work.
// define responder test ("/test", secure?: #t)
// (request, response)
// format(output-stream(response),
// "<html><body>test</body></html>");
// end;
define macro responder-definer
{ define responder ?:name (?uri:expression, ?uri-args:*)
(?request:name, ?response:name)
?:body
end }
=>
{ define method ?name (?request, ?response) ?body end;
register-response-function(?uri, ?name, ?uri-args) }
end;
Follow-Ups:
References: