At Tue, 24 Aug 2004 15:19:52 -0400, Dan Sugalski wrote: > > At 11:47 AM -0700 8/24/04, Sean O'Rourke wrote: > >At Tue, 24 Aug 2004 13:33:45 -0400, > >Dan Sugalski wrote: > >> 7) Strings are treated as floats for math operations > > > >I think we can do better than this by first converting a string to the > >"least" reasonable numeric type (with int < float < bignum), then > >re-dispatching to the appropriate numeric x numeric operation. Always > >treating strings as floats means we lose both when 2+3 != 2+"3" and > >when one of the strings is too large to be a floating-point number. > >Also, doing this redispatch means that the printed and internal > >representations of numbers will always behave the same way. > > I'm still not sure about doing dynamic down-typing (or whatever it's > called) to get the tighest possible type. I'm getting the distinct > feeling that it's what most people want, though. :)
This doesn't have to involve dynamic down-typing, only a string-to-numeric converter that returns the most specific type. After that, operations between two numeric objects are welcome to do whatever they want. I actually agree with you that it's just not worth it to check for possible down-conversions. /s