Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!hp4nl!media01!pkr From: pkr@media01.UUCP (Peter Kriens) Newsgroups: comp.object Subject: Re: inheritance and `type loss' Message-ID: <1284@media01.UUCP> Date: 12 Jul 90 08:01:43 GMT References: <1130012@gore.com> <1990Jul11.184517.16505@swbatl.sbc.com> Reply-To: pkr@media01.UUCP (Peter Kriens) Organization: Mediasystemen, Netherlands Lines: 19 Roman nummerals and integers, What is the result of 1 + V and V + 1? Isn't the fact that this problem is exactlt what Smalltalk does with coercion? In Smalltalk each class under Number gets a priority. When you are doing arithmetic with any number, it will compare the numbers and coerce the lower number into a new type of the higher number. This way the class itself can decide what the result is of V+1. So if V would return a higher priority than the integer 1, the 1 would be coerced into a roman nummeral and then the add message would be send again. It is some time ago that I looked into this matters, but as far as I remember this is the way it works in Smalltalk and CO2. Peter Kriens