1.0 ?? [templates and currying]
Tom S
h3r3tic at remove.mat.uni.torun.pl
Mon Nov 6 17:13:59 PST 2006
Walter Bright wrote:
> BTW, I am considering changing the ==function and ==delegate is
> expressions, which you use, to the following:
>
>
> ==return gets the return type:
>
>> template Return(dg)
>> {
>> static if (is(dg R == return))
>> alias R Return;
>> else
>> static assert(0, "argument has no return type");
>> }
>
> ==function or ==delegate gets the parameter types as a tuple:
>
>> template Parameters(dg)
>> {
>> static if (is(dg P == function))
>> alias P Parameters;
>> else static if (is(dg P == delegate))
>> alias P Parameters;
>> else static if (is(dg P == P*))
>> alias Parameters!(P) Parameters;
>> else
>> static assert(0, "argument has no parameters");
>> }
>
> This will require some adjustment in your code. I didn't think anyone
> was using that stuff. Will it be an issue for you? Or should I find
> another way to do it?
Whoa, That would be awesome ! I don't think anyone would mind such a
change :)
I'm certainly not the only one to use that code/feature. E.g. that link
I gave you is from Kirk's Pyd, which contains modified versions of my
code. It's also based on efforts from Daniel Keep. But I'm sure they
will gladly welcome the enhancement you're proposing :)
One question thought: will the 'P' tuple from your example be able to
remember in/out/inout/lazy modifiers ?
--
Tomasz Stachowiak
More information about the Digitalmars-d
mailing list