On 12/2/05, Maximilian Wilson <[EMAIL PROTECTED]> wrote: > operation. This wouldn't matter so much if Floats didn't have such > very different properties from Ints, unlike say fixed-point numbers... > it makes it very difficult to reason about the semantics of your > calculation. I am more and more coming to appreciate Mozart's strict > aversion to arithmetic type coercion.
Come to think of it, it strikes me that C-style type promotion (an int is a float) is a bad idea for the same reason that "a square 'IS A' rectangle" is now widely considered to be a fallacy. A square has the same *data* as a rectangle, but it has extra constraints, so the Liskov substitution principle doesn't hold if squares are mutable. (Trying to adjust e.g. the height of a rectangle may break an assumption that the length remains constant, if the rectangle is a mutable square.) Conversely, a rectangle is not a square because it lacks some of its properties. A subtype relationship is not appropriate in either direction, and the same is true for floats and ints. Max -- Be pretty if you are, Be witty if you can, But be cheerful if it kills you. _________________________________________________________________________________ mozart-users mailing list [email protected] http://www.mozart-oz.org/mailman/listinfo/mozart-users
