for some cross rally some thought crazy. ( read: i need a type system for my
email! )
Oh, before i introduce you to a very bad duck, check out the very good duck at
_whyTheLuckyStiff's home page: http://whytheluckystiff.net/. It's awesome!
Okay, now the bad duck. Consider this example of my euphoric type system:
class TypeTest
type (:big4, '>', 'to_i', 'succ')
def ameth(x)
big4 x
#---
x > 4
end
end
typechecking true
t = TypeTest.new
t.ameth(5) # => 5 good
t.ameth(4) # => 'big4' : 4 (TypeError) good
t.ameth('5') # => `>': comparison of String with 4 failed (ArgumentError)
bad duck!
you see we have a problem here. it doesn't matter what methods are
implemented, because '>' for a String and '>' for a Numeric don't DO
the same KIND OF thing. the operators are overloaded. so respond_to? isn't
enough. we end up having to think about what will be passed to those
responding methods as well -- we end up having to ask not only, can you
handle the responsibilities? but can you handle the arguments? (sounds like a
thread i know ;)
this problem not only effects my system, by Sean's as well, which by the way
are not so distinct. we can of course say that it's GOOD ENOUGH, but some
might say, that's just quackery. (can you guezz who?)
so while there are good ducks, like _whys, their are also not-so-good ducks.
and ducks in general are not always what their "quacked" up to be, just like
that kind_of? beast.
-t0