opImplicitCast/opImplicitCastFrom

bearophile bearophileHUGS at lycos.com
Mon Oct 27 09:31:13 PDT 2008


Hxal:

>No point putting ranged types into the language if it can be made perfectly doable at library level. If you put them in the standard lib, people who care about security will surely use them. (At least if you don't call the type Bounded :P)<

Unfortunately I think such library solution is nearly useless. Programmers are lazy, and lot of them even actively resist changes and ideas that may improve their programs. So I fear that you will see very few programs pasted in this newsgroup that show the usage of that syntax of yours everywhere in the program. And if you suggest the poster to do that change you will receive bites, like when I suggest people to improve the syntax and idioms of some programs shown here.

Even if you put a built-in syntax for ranged types, it's probably quite useless still. If you look at the C language sometimes programmers insert bugs in the code because they forget to initialize vars. D turns the situation over, adding a syntax to not initialize variables, avoiding most of those bugs. The situation with range checkes is similar (not equal, because while the compiler can infer to remove some range checks, some of them have to be left for runtime, this changes the code performance a little, so the situation is more similar to the current bound checks done on of arrays, disabled by -release).

Bye,
bearophile



More information about the Digitalmars-d mailing list