> > The reason Eiffel is a bit better off here is that you can state the > > - class invariant for a class > > - preconditions for a method > > - postconditions for a method .... > Indeed, I would have thought it especially _easy_ to add such features to > well-designed dynamic languages. I'm not familiar with Eiffel, so I may be off the track but... If pre/post conditions can be added to Ruby in a way the removes some of the dynamic behaviour, this can be extremely valuable for a Ruby compiler. If such checks were dynamic, you need not really add anything to the language, you would just need insert assertions into the code (simplified - there is the subclassing issue). The JScript.Net compiler uses type inference to identify possible value types. It would be obvious to do something similar with Ruby. With the addition of invariants, the typeinference could be improved. A compiler switch could also be used to assume that the invariants are true, after a program has been thoroughly tested. While typeinference would not be the primary argument for adding invariants, I think this aspect should be carefully considered if such a feature is added. The nice thing about invariants are, that they are 1) more precise than the typical type declaration in a "typesafe" language. 2) they are optional. That is, the user is not forced to declare variables and types. Mikkel