From: Martin DeMello Date: 2003-09-14T18:23:05+09:00 Subject: Re: Duck Typing Ryan Pavlik wrote: > On Sun, 14 Sep 2003 15:22:37 +0900 > Martin DeMello wrote: > > >> Any yes, it's by no means specific to Ruby, but it is the way the >> language defines a 'type'. > > No, it's how _you the programmer_ define a 'type'. You have a few > options here; "duck typing" is just one of them. It has nothing to do > with what the languages specifies in this case. The only type checking the language does by default is to (dynamically) see if a given object responds to a given message. Checking explicitly for responds_to?, is_a? etc. merely add additional restrictions atop the type system. By analogy, you could hack the built-in classes so that all numbers were strictly integral, but you couldn't say that the language was agnostic towards supporting reals. martin