From: Ben Tilly Date: 2001-01-22T14:19:16+09:00 Subject: [ruby-talk:9702] Re: 101 Misconceptions About Dynamic Languages Dave Thomas wrote: > >"Christoph Rippel" writes: > > > try to express this in Ruby - it is going to be a nightmare. (This having been a basic ring construction.) >Perhaps you could help me understand the problem. The Ruby solution >would seem to my naive eyes about half the size an considerably >clearer. Without the need to jump through template hoops for type >safety, most of the issues of genericity seem to go away. > >What am I missing? Constructing Z/n is a special case of a generic construction that you see in ring theory. The general idea is that you take a ring R (eg Z), and a subring I (eg the multiples of 5) with the special property that anything in R times anything in I gives you something back in I. You can now say that two elements x and y are the same mod I if x-y is in I. Each equivalence class can now be represented by a single element in R, and the set of equivalence classes turn out to be a new ring R/I. In my books a good model of Ring would be able to handle this common and basic construction. That would mean (for instance) being able to handle the idea that evaluating x=5 can be done in Q[x] (the ring of polynomials over the rationals) by modding out by the ideal (x-5). (Ruby might do this, I don't know. But to my eyes this is a statement of the general problem that I see in modelling concepts like Ring in an OO hierarchy.) Cheers, Ben _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com