Y
Hacker News
new
|
ask
|
show
|
jobs
by
Skoofoo
4118 days ago
Ruby is duck-typed, so it is advantageous to write code and tests that are not tied to classes at all.
http://www.poodr.com/
goes in-depth about this.
1 comments
grandalf
4118 days ago
Well, the same kind of contracts approach could be used to enforce a duck-typed set of behaviors:
[:quacks], [:barks] => Maybe[:flies]
Some Rubyists get pedantic about duck typing. It's just a tool to design good systems, not an article of faith.
link
masklinn
4117 days ago
Yeah the contract here is a form of nominative type checking, it could just as well be structural.
link