if it quacks like a roll of tape…

I’ve found a surprising number of sites (even Ruby ones) that think it’s duct typing instead of Duck typing

I wonder why they think it’s called “duct”?  Because it holds everything together like the force?

On a related note, I like how Boo allows you to choose whether you want Duck typing or not.  This is a nice compromise, and it would be nice to have something like it in C#. šŸ™‚

Along with the normal types like object, int, string…boo has a special type called “duck”. The term is inspired by the ruby programming language’s duck typing feature (“If it walks like a duck and quacks like a duck, it must be a duck”).

If you declare an object as type duck or cast to type duck (or turn on the implicit duck typing option, see below), then boo will not try to resolve any methods or operations you call on that object at compile time. Instead it will convert those operations into methods that do not resolve until runtime. So at compile time it simply trusts that you know what you are doing (“it walks like a duck so it must be a duck”).


One thought on “if it quacks like a roll of tape…

  1. Duck Typing — sounds ludicrous, figures you know what your doing. Think about the number of hours you have spent tracking down stupidity errors or logic errors and you know you knew What you are doing??

Comments are closed.