disabling unary "-" for unsigned types

Lutger lutger.blijdestijn at gmail.com
Tue Feb 16 00:25:28 PST 2010


Walter Bright wrote:

> Steven Schveighoffer wrote:
>> For example, there is no possible way a person unfamiliar with computers
> 
> That's a valid argument if you're writing a spreadsheet program. But
> programmers should be familiar with computers, and most definitely
> should be familiar with 2's complement arithmetic.
> 
> Similarly, if you do much with floating point, you should be familiar
> with "What Every Computer Scientist Should Know About Floating-Point
> Arithmetic"
> 
> http://docs.sun.com/source/806-3568/ncg_goldberg.html

It's a valid viewpoint, but it is a 'should'. I believe many programmers 
have only passing familiarity if at all with the semantics of unsigned types 
and floating point operations. At least when coding, they don't have these 
semantics in mind. Why do you think Java doesn't have unsigned types? 

As the language designer you can say that your target users must have this 
knowledge, that's fine. Paraphrasing Alexandrescu: this is one of those 
fundamental coordinates that put D on the landscape of programming 
languages. I'm quite sure though that when you go look at the empirical side 
of the story, 'should' does not equate with 'is'.

However D does seem to target C#/Java and even python programmers. It is 
often suggested D's 'system programming' features are not actually *needed* 
and it offers enough high-level and safe features for programmers not 
comfortable with C / C++ to program effectively. This reasoning does not 
hold for unsigned integers and floating point vagaries. 






More information about the Digitalmars-d mailing list