What did you think about an implicitConversionOp ?

sighoya sighoya at gmail.com
Sun Dec 27 12:33:35 UTC 2020


Thanks a lot for your insights.

Some questions:

>And also painful when you thought one function was returning one 
>type,
> but it actually returns a different type,

You speak about the mix of templates and implicit conversion.

I may be too limited to see that, but I thought once the template 
parameter is bound it can't change anymore, hence implicit 
conversion occurs without to rebind the template parameter.
Am I wrong?

>Or worse, you need to
> store a value in a struct somewhere, but due to implicit 
> conversion the type you get out of a function does not match 
> the type in the struct, and changing the struct's field type 
> will lead to a huge amount of changes

This could be true, but it relates to `alias this` which isn't 
either `implicitConversionOp` nor `implicitCoercionOp`.

>There have also been
> occasions of actual bugs introduced by implicit conversions -- 
> because some value implicitly converted earlier than expected

Okay, maybe I need just a delightful example about this.


More information about the Digitalmars-d mailing list