From: Eivind Eklund Date: 2008-02-01T06:47:48+09:00 Subject: Re: Gedankenexperiment on method duck type safety On Jan 31, 2008 8:25 PM, Tim Connor wrote: > And I know this doesn't fit with he already complex enough method > declarations in ruby. It's just faux ruby style, because that is my > favorite dynamic language. So, without further prevarication, here is > the aforementioned abomination, for either discussion sake, or > pointing and laughing, whichever floats your boat: > > def foo(bar.is_? Array, !bar.is_empty?, baz.responds_to :webbed_feet) See code implementing something similar at http://people.freebsd.org/~eivind/ruby/types/ typesig Type::And(Array, Type::RespondFalse(:is_empty?)), Type::RespondTo(:webbed_feet) def foo(bar, baz) ... end You'd have to implement Type::RespondFalse - should be trivial. Eivind.