Sam Ruby skrev: > If we are timid (or responsible, either way, it works out to be the > same), then we should say no new values for typeof should ever be > minted, and that means that all new data types are of type object, and > none of them can ever have a value that is treated as false. > > If we are bold (or foolhardy), then we should create new potential > results for the typeof operator early and often.
I think there's a false assumption at work here. It assumes that typeof returning "decimal" will break more programs than returning "object". The opposite is just as likely, in my view. If my program can cope with all types, then I'll code for that /explicitly/. My switch-case will end with a default that deals with any type. If I don't write it that way, it's because my code can't cope with it that way. In that case I might end my switch-case with a default that throws an error intended for the programmer, to notify me and help me upgrade. This is defeated if the language assumes that my program can cope with numbers claiming to be "object". Either way, some programs will work fine with it and some will fail. When this happens I think the best approach is to ask "What is the most useful in the long run, in decades to come?" In that perspective I find (typeof 3m) returning "object" strange and inconsistent, and "decimal" very acceptable. -- Ingvar von Schoultz _______________________________________________ Es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

