Function parameters name
Julian
julien at onandon.be
Thu Sep 10 11:34:57 PDT 2009
Hello,
I'm trying to obtain the parameters name of a function via __traits.
The patches are on bugzilla :
http://d.puremagic.com/issues/show_bug.cgi?id=3309
Could you please review this ?
Provided test case works.. but I actually have a problem with
FuncDeclaration->parameters being NULL when the function is declared in
another module.
The main idea is to build a small web framework going along the lines
of :
class HelloResource
{
string show(in string username)
{
return "Hello, " ~ username;
}
}
(new ResourceMapper).connect!("/hello/{username}")(new
HelloResource);
http://www.example.com/hello/Julian : `show` method would be called
with "Julian" being the `username` parameter.
class UsersResource
{
User[] show(in ushort offset, in ushort limit)
{
return [ user0, user1 ];
}
}
(new ResourceMapper).connect!("/users")(new UsersResource);
http://www.example.com/users?offset=0&limit=10 : `show` method would
be called with 0 being the `offset` parameter and 10 being the `limit`
parameter.
Thank you,
Julian.
More information about the Digitalmars-d
mailing list