Bring back foreach int indexes - bug prone implicit conversions
Nick Treleaven
nick at geany.org
Fri Dec 1 12:38:05 UTC 2023
On Thursday, 30 November 2023 at 11:54:01 UTC, IGotD- wrote:
> One of the corner stones in D is that there are hardly any
> implicit conversions.
I don't think that is true. In modern languages these would not
be allowed:
typeof(null) -> T*
Often I want a pointer that always points to a T, e.g. for
function arguments.
uint -> int
int -> uint
Even C compilers can catch these with warnings on.
int -> dchar
byte -> char
Then there's the problem of 0 and 1 matching a bool overload
instead of int.
enum Enum {member = 1}
Enum e = Enum.member << 2; // wait, 4 isn't in Enum
I hope most of these can be disallowed in D3.
More information about the Digitalmars-d
mailing list