On Wed, Aug 23, 2006 at 08:40:17AM +0900, Francis Cianfrocca wrote:
> On 8/22/06, David Vallner <david / vallner.net> wrote:
> >
> > In dynamically typed languages, the type of an object isn't its "class"
> >or any other predictable concept, it's just the protocol it adheres to
> >during its lifetime. Most such languages also make no presumption that
> >this protocol, or the behaviour of an object remains the same during its
> >lifetime - which makes compile-time checks rather pointless.
> >
> >Of course, you rarely use even this aspect of dynamic typing - in fact,
> >I can't come up with a single noncontrived example for it, these things
> >just don't occur in daily coding. But dynamic languages sure a heck
> >faster to type, and the fact the compiler rarely bitches at all is very,
> >very appealing to people that know what they're doing most of the time.
> 
> That was a perceptive comment. The fact that there are so few true cases of
> objects that metamorphose in flight also accounts for the observed "magical"
> behavior that "duck-typing" seems to "just work" almost all of the time. (By
> magical, I mean unexpected for people like me with too many years of
> experience programming in statically-typed languages.) The intention of a
> well thought-out code path is generally easy to express without typing all
> the types along the way. It doesn't break often, and when it does break, it
> doesn't make a big mess.

I think much of the reason for difficulty enumerating common-case
benefits derived from dynamic typing is the simple fact that dynamic
typing makes other language features possible, or at least (easily)
usable, that would otherwise be prohibitively difficult to implement.
In other words, duck typing works silently behind the scenes most of the
time, providing the foundation for other, more direct benefits, but
doesn't jump up in your face taking credit for stuff.

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
unix virus: If you're using a unixlike OS, please forward
this to 20 others and erase your system partition.