On Oct 27, 10 10:26, Walter Bright wrote:
Ellery Newcomer wrote:
Question: would it be feasible to make D use some sort of bignum type
as the default index type for arrays, etc, but make it possible for
the programmer to use uint or ulong or whatever for e.g. places where
performance is an issue?
I suspect that's a big jump in complexity for very little gain.
I also suspect that it would result in a drastic performance problem
(remember, Python is 100x slower than native code), and will disable the
advantages D has with type inference (as the user will be back to
explicitly naming the type).
Python is slow because it's interpreted with almost no optimization, not
because of bignum.
You should try Haskell, which has the built-in Integer type (bignum) and
Int type (fixed-size integer). The performance drop is at most 20% when
the size is compatible with Int.
I don't think there's much value left for add-on static analysis tools.
I went to the trouble of modifying dmd to warn on unsigned/signed
comparison. It found me some bugs which probably would not have been
noticed otherwise. Did it produce false positives? Yes. Did that make
me wish I hadn't done it? Hell no.
You might want to consider changing your coding style to eschew the use
of unsigned types.
The key idea is leave the warnings off unless the programmer
explicitly asks for it.
That's a good sentiment, but it doesn't work that way in practice.
Warnings always become de-facto requirements. They aren't the solution
to a disagreement about how the language should work.