null references redux + Looney Tunes
    Denis Koroskin 
    2korden at gmail.com
       
    Sun Oct  4 15:38:58 PDT 2009
    
    
  
On Mon, 05 Oct 2009 01:03:01 +0400, bearophile <bearophileHUGS at lycos.com>  
wrote:
> Walter Bright:
>
>> The
>> big reason for moving it to a library type is the user defined type
>> capabilities of D have grown to the point where there is no longer much
>> of any advantage to having it built in.
>
> If the compiler/language is now flexible enough to allow the creation of  
> a very good complex number, and the compilation time for such library  
> numbers is good enough, and they get compiled efficiently enough, then  
> removing them from the language is positive. But is the compiler now  
> good enough to allow to implement very good complex numbers in the std  
> lib?
>
> One problem is to have a good syntax to define and use complex numbers.  
> Time ago I have even suggested to keep the complex syntax in the  
> compiler, and move the implementation in the std lib.
>
> Another problem that I think is present still is the lack of a method  
> like opBool, that gets called in implicit boolean situations like  
> if(somecomplex){...
>
> A third and more serious question is if the library complex type avoids  
> the pitfalls discussed in the page about built-in complex numbers in the  
> digitalmars site.
>
> Bye,
> bearophile
I don't see any reason why if (someComplexNumber) { ... } should be a  
valid code, it hardly makes any sense for me.
In fact, I am trying to avoid if (foo) as much as possible (unless foo is  
a bool, of course):
if (somePtr !is null) {
}
if (someInt != 0) {
}
but:
if (someCondition) {
}
I wouldn't like to sacrifice code clarity for saving a few keystrokes, but  
maybe it's just me.
    
    
More information about the Digitalmars-d
mailing list