[Prev][Next][Index][Thread]
Re: definer macros
> 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.
Isn't it just that the syntax of the original macro was ambiguous?
The pattern was:
> define macro responder-definer
> { define responder ?:name = ?uri:expression
> (?request:name, ?stream:name)
> ?:body
> end }
>From the example that came with the second version I guess a test for
the original might be:
define responder test = "/test"
(request, stream)
format(stream, "<html><body>test</body></html>");
end;
Trouble is, ?uri:expression will eat the argument list as well as the
string:
"/test"(request, response)
It's a stupid expression I grant you, but an :expression match just
the same. ;)
The macro system only backtracks over wildcards, so when it tries to
match what's left of the input against (?request:name, ?stream:name)
you're sunk.
-- Keith
References: