this is almost a workaround for the lack of named parameters
Jacob Carlborg
doob at me.com
Thu Mar 21 13:58:19 PDT 2013
On 2013-03-21 21:42, J wrote:
> Intriguing, Jacob! I could learn alot about reflection by studying your
> code.
>
> How is it installed? I installing by downloading that single file, and
> with a quick hack to the Reflection.d top three lines (commenting out
> the module and imports at the top), I tried calling it with this, no luck:
>
> #!/usr/bin/rdmd
>
> import Reflection; // with module and imports commented out...
> import std.stdio;
>
> string my(int a, int b) {
> writeln(a/b);
> return "howdy";
> }
>
> void main(string[] arg) {
>
> auto s = callWithNamedArguments(my, `a=3, b=4`);
> }
>
> // yields:
>
> $ ./ref.d
> ./ref.d(13): Error: function ref.my (int a, int b) is not callable using
> argument types ()
> ./ref.d(13): Error: expected 2 function arguments, not 0
It's been quite a while since I tested that code. I'll see what I can do.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list