A template for method forwarding?

Denis Koroskin 2korden at gmail.com
Fri Dec 12 16:31:25 PST 2008

On Sat, 13 Dec 2008 03:27:42 +0300, Christopher Wright <dhasenan at gmail.com> wrote:

> Bill Baxter wrote:
>> On Sat, Dec 13, 2008 at 6:13 AM, Bill Baxter <wbaxter at gmail.com> wrote:
>>> Cool.  I don't see anything D2 specific there, so I think it should
>>> work in D1 ok.
>>> std.traits.ParameterTypeTuple and std.traits.ReturnType both exist in
>>> D1, if that's what you were worried about.
>>> I think there may be a problem with 0-arg functions in the code?
>>> You handle the void return type (which I'm not sure is necessary
>>> actually -- I think D lets you say "return foo()" for a void function
>>> specifically to handle this kind of template situation), but I think
>>> maybe you don't handle a void argument?    I'm getting an error with
>>> that for some reason... will dig more.
>>  Actually I think it's not zero-arg functions.
>> The problem is that one of my arguments is a templated type.
>> The .stringof says the parameter type is TheTemplate, when the
>> argument type is really TheTemplate!(T).   So when your code tries to
>> generate the function it tries to make it    void
>> aFunction(TheTemplate x) { ... }, which obviously ain't gonna fly.
>>  So looks like bad stringof is the culprit, once again.
>>  --bb
> This case is a known bug and has a patch.
> Really, stringof should give a fully qualified name, and any template  
> parameters should use fully qualified names. The existing patch doesn't  
> do that, but it's a minor improvement.

I don't know if it is a good thing to have. Do you understand how much bigger executable size becomes?

More information about the Digitalmars-d mailing list