Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!parc!boehm From: boehm@parc.xerox.com (Hans Boehm) Newsgroups: comp.object Subject: Re: A Hard Problem for Static Type Systems Message-ID: Date: 25 Apr 91 19:37:54 GMT References: <1991Apr20.010347.28984@leland.Stanford.EDU> <1991Apr24.032543.11704@leland.Stanford.EDU> <1991Apr25.011607.25536@leland.Stanford.EDU> Sender: news@parc.xerox.com Organization: Xerox PARC Lines: 20 It's not entirely clear to me what you're trying to achieve by viewing integer and float as subtypes of number. They presumably share no code, hence code reuse is not the issue. There is no real possibility of adding further subtypes without modifying the existing ones. (You would have to add definitions of < for all newly introduced combinations.) Thus it seems that in this case subtyping is equivalent to viewing number as the union of integer and float, with < suitably defined on the union. Essentially all of the languages under discussion can deal with that. There are problems with this, but they are essentially syntactic. I may not want to write convert_to_number(3.5). (If I care about "performance transparency", I may want to write it, since convert_to_number(x) may cost a lot more to evaluate than x. I may have to convert a floating point value in a register to a pointer to a tagged value in the heap.) Thus there are sticky issues about inferring injections into a union. In this case it doesn't seem hard. But a general elegant solution probably is hard, at least if it's also capable of inferring the type argument to min. Hans (boehm@xerox.com)