opDispatch and template parameters

bearophile bearophileHUGS at lycos.com
Tue Sep 14 18:48:50 PDT 2010


Simen kjaeraas:

> It's the way the language works. Just like D does not support
> automatic currying of functions, like this:
> 
> void foo( int n, string s ) {}
> auto bar = foo( 4 );
> assert( is( typeof( bar ) == void function ( string ) ) );
> 
> Neither does it support automatic currying for templates. Hence,
> all arguments must be passed in one go. The above is in a way
> doable in D, but only by jumping through hoops:
> 
> auto foo( int n ) {
>      return ( string s ) {};
> }
> foo( 4 )( "my string!" );

See also std.functional.curry (never used it).

Bye,
bearophile


More information about the Digitalmars-d mailing list