From: Ned Konz Date: 2001-11-27T01:23:06+09:00 Subject: [ruby-talk:26525] Re: String#== : Why not error with different type? On Monday 26 November 2001 04:05 am, Ryo Furue wrote: > I got it! Thanks for the explanation. It seems that I've spent too > much time with statically-typed languages and I've been "spoiled" by > the sense of security that statically-taped-ness brings. But, I > wonder: Don't you (not only you, Matz, but also you Ruby programmers > in general) a little bit fear this flexibility? In my years of experience with Smalltalk, this just isn't an issue. The vast majority of the "does not understand" situations in Smalltalk come from the common but questionable practice of representing optional relationships using nil or another object. Since nil doesn't understand very many messages, you see the walkback. Using objects instead of nil that have the right interface is much safer and more flexible; you don't have to write a lot of conditional code like: something ifNotNil: [ something doSomething ]. When you _do_ have a type mismatch (in early development), it's caught early and easily when running your unit tests. After all, we don't often apply arbitrary operations to a collection of objects of unknown type: it wouldn't be too useful. -- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com