unsigned policy (implicit conversions for complex?)

Bruno Medeiros brunodomedeiros+spam at com.gmail
Tue Feb 13 04:02:51 PST 2007


Derek Parnell wrote:
> On Mon, 12 Feb 2007 18:59:49 -0800, Walter Bright wrote:
> 
>> Derek Parnell wrote:
>>> On Mon, 12 Feb 2007 16:03:14 -0800, Andrei Alexandrescu (See Website For
>>> Email) wrote:
>>>
>>>> http://erdani.org/d-implicit-conversions.pdf
>>>  
>>>> Did I forget something?
>>> Characters are not numbers. 
>> That's an enticing point of view, and it sounds good. But Pascal has 
>> that view, and my experience with it is it's one of the reasons Pascal 
>> sucks.
>>
>> Examples:
>>
>> 1) converting text <=> integers
>> 2) converting case
>> 3) doing compression/encryption code
>> 4) using characters as indices (isspace() for example)
>>
>> Take away the implicit conversions, and such code gets littered with 
>> ugly casts.
> 
> D has a neat property sub-system already. For example, it is used to get at
> the underlying implementation data for arrays. So why not call spade a
> spade and stop helping bug-making. You have recently done this with
> implicit conversion from array pointers and arrays. If characters had a
> property called, for example, ".numval" then ugly casts would not be needed
> *and* such special character usage will be documented.
> 

I was thinking pretty much the same. That (the ".num" property) together 
with the idea that Joel Salomon presented (that we could still allow 
subtraction of characters without casts) would neatly solve any problems 
in disallowing the implicit conversion of char to numbers.

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list