Implicit castable structs

Dan murpsoft at hotmail.com
Wed Jan 9 17:32:39 PST 2008


Perhaps, to clarify;
What I've got:

static Value Global_parseFloat(Value self, Value cc, Value[] a ...) { 
    if(a.length) 
        return cast(Value) a[0].toReal(); 
    return NAN; 
} 

static Value Global_isNaN(Value self, Value cc, Value[] a ...) { 
    return cast(Value) ( (!a.length || a[0].toReal() == real.nan?) true : false); 
}

~~

What I want:

extern(Walnut):

Value Global_parseFloat(Value[] a ...) {
    if(a.length)
        return cast(real) a[0];
    return real.nan;
}

Value Global_isNaN(Value[] a ...) {
    return (!a.length || cast(real) a[0] == real.nan);
}




More information about the Digitalmars-d mailing list