implicit construction operator

TheFlyingFiddle none at none.com
Mon Feb 26 21:45:03 UTC 2018


On Monday, 26 February 2018 at 21:30:09 UTC, aliak wrote:
> On Monday, 26 February 2018 at 19:32:44 UTC, ketmar wrote:
>> WebFreak001 wrote:
> And if that's also a no no, how about char -> int. Or int -> 
> float? Is ok?
>
> Maybe there're some valid arguments, to disallow it 
> *completely* though?
>
> Cheers

I would be very happy if char -> int and int -> float was not 
implicit.

This has happened to me enough times that i remember it:

float a = some_int / some_other_int; //ops i don't think this was 
what I wanted.
constrast
float a = some_int.to!float / some_other_int.to!float; //ugly but 
at-least its clear.

Not really a big deal (and auto kind of ruins it) but it would 
make stuff consistent between user types and built in ones.


More information about the Digitalmars-d mailing list