Fully dynamic d by opDotExp overloading

Simen kjaeraas simen.kjaras at gmail.com
Sat Nov 28 16:50:24 PST 2009


On Sun, 29 Nov 2009 00:37:34 +0100, Walter Bright  
<newshound1 at digitalmars.com> wrote:

> davidl wrote:
>> Any comments? Do you like this feature?
>
> And here it is (called opDispatch, Michel Fortin's suggestion):
>
> http://www.dsource.org/projects/dmd/changeset?new=trunk%2Fsrc@268&old=trunk%2Fsrc@267

Just tested it - it does not seem to allow template parameters beyond just  
the
function name. Is this something we can expect in the future?
The use case I have is this:

struct foo {
   void opDispatch( string name, T )( T value ) {
     static if ( is( T == float ) ) {
       // Do something
     } else static if ( T == int ){

     } else {
       static assert( false, "Unsupported argument type." );
     }
   }
}

Thank you,
   Simen



More information about the Digitalmars-d mailing list