DIP 52 - Implicit conversions

John Colvin john.loughran.colvin at gmail.com
Fri Dec 13 02:46:32 PST 2013


On Friday, 13 December 2013 at 10:39:41 UTC, Joseph Rushton 
Wakeling wrote:
> On 13/12/13 01:23, IgorStepanov wrote:
>> You can write something like:
>>
>> void acceptMyType(T)(T arg) if(is(T == MyType))
>> {
>> ...
>> }
>>
>> Yes, this way is complex, but this situation is rare and we 
>> can put up with it.
>
> Yes, that's exactly the method I was thinking of.  I really 
> found it very beautiful when I saw it inside std.bigint and 
> realized what it was meant to do, but I think it's _very_ prone 
> to being accidentally "corrected" on the assumption that it's 
> meant to be is(T : MyType).

a quick "//no implicit conversion allowed" is surely adequate 
here. At the very least it would make someone think twice before 
breaking it.


More information about the Digitalmars-d mailing list