sumtypes for D

zjh fqbqrr at 163.com
Tue Nov 29 06:51:09 UTC 2022


On Tuesday, 29 November 2022 at 04:12:14 UTC, Paul Backus wrote:

> Walter Bright is strongly opposed to adding user-defined 
> implicit conversions to D. You can search the forum for his 
> posts on the subject; here is one example:
>
> https://forum.dlang.org/post/rs9k19$1982$1@digitalmars.com


In C++, I have never used implicit conversion. I just add an 
`explicit`.
This seems to be a problem of "const" limitation. I think that, 
like `user defined implicit conversion`, you can add an attribute 
to machine check. In this way, users are only allowed to add an 
"implicit conversion" of a "specific" attribute, which may be a 
real implicit conversion, indicating that the user knows what he 
is doing.




More information about the Digitalmars-d mailing list