Type wrapping blockers

Steven Schveighoffer schveiguy at yahoo.com
Wed Oct 6 04:26:43 PDT 2010


On Tue, 05 Oct 2010 08:50:04 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> One of the best methods to wrap a type is to use opDispatch.  But there  
> are some problems that block this.  It might be good to get a bug report  
> that gathers these together.  I have one that I just ran into -- IFTI  
> and literals.  Basically, if you have a function:
>
> void foo(short x);
>
> you can call foo(1) no problem.
>
> But if you *wrap* the type that contains foo, you cannot use opDispatch  
> to implement foo(1), because IFTI treats 1 as an int.  So what you get  
> is an instantiation of opDispatch like this:
>
> opDispatch!("foo", int)(1)  Which then cannot call foo, because you  
> cannot cast int to short.
>
> Does anyone have any ideas on how to fix the above issue?

I found a solution:  http://d.puremagic.com/issues/show_bug.cgi?id=4998

Anyone see any holes in it?

BTW, bug 5000 coming up!  Big milestone :)

-Steve


More information about the Digitalmars-d mailing list