I'll have the duck!

H

Hal Fulton

even though we all know the duck typing that can be named is not the
real duck
typing.

sorry, couldn't resist ;-)

Haha... well, if you can quote Lao Tzu, I can quote
Confucius. I ran across this quote from him last
year (no kidding) and it reminded me of duck typing:

"If an urn does not have the properties of an urn,
can it truly be said to be an urn?"

Shades of Plato, actually...


Hal
 
M

Mc Osten

Dumaiu said:
No, really, what *is* the sound of a duck typing?

I suppose the very same a human does when typing. However, probably what
it types would be less meaningful.
 
M

Martin DeMello

Haha... well, if you can quote Lao Tzu, I can quote
Confucius. I ran across this quote from him last
year (no kidding) and it reminded me of duck typing:

"If an urn does not have the properties of an urn,
can it truly be said to be an urn?"

To which, of course, the answer is "no, it hasn't urned the right"

martin
 
C

Chad Perrin

On Tue, Jul 25, 2006 at 01:05:11PM +0900, Dumaiu wrote:
=20
=20
By your argument, exceptions are bad too, because they catch errors
"late". And IMHO exception handling was one of the better points when
going from C to C++. Think of duck typing as yet another technique not
to litter your code with error checking, but still do it
somewhere/sometime. You do handle C++ exceptions too, do you, if not
neccessarily right next to throwing them?
=20
I repeat: duck typing is not to produce bombing out code, but a new*
way to handle dynamic and flexible type validation "late", with the
objective to ease development and produce clean code.

I'd say that duck typing is more a means of allowing you to defer
rigidity until it's actually beneficial. It has little or nothing to do
with delaying validation, and everything to do with avoiding the
unfortunate circumstance of having to validate before it's convenient
for your code to have something to validate.

--=20
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"The ability to quote is a serviceable
substitute for wit." - W. Somerset Maugham
 
C

Chad Perrin

=20
CLOS (Common Lisp Object System) has multi-dispatch too.
=20
It is more powerful than smalltalk or ruby's message based OOP
approach. It is also hard to design in, if you aren't used to it.
Given that some people coming from static languages are still
wrestling with plain old duck typing, I think it would be overkill for
ruby, and hard on a lot of people. It's just not ruby's niche.

I agree. If we were going to go that route, we'd probably want to give
Ruby a functional syntax, at which point we'd just be using Lisp anyway.
Let's keep Ruby its own language.

--=20
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"The ability to quote is a serviceable
substitute for wit." - W. Somerset Maugham
 
J

Jacob Fugal

I'd say that duck typing is more a means of allowing you to defer
rigidity until it's actually beneficial. It has little or nothing to do
with delaying validation, and everything to do with avoiding the
unfortunate circumstance of having to validate before it's convenient
for your code to have something to validate.

That is one of the most concise statements on the benefits of
duck-typing I've ever read. Thanks, Chad!

Jacob Fugal
 
M

Matt Todd

Duck typing appeals to me specifically because it lets me say that I
have a class of People and I can treat them as a list without having
to do specific inheritence, et c.

Also, on the other-languages discussion, IO is also a
prototype-based-OO language.

M.T.
 
C

Chad Perrin

Also, on the other-languages discussion, IO is also a
prototype-based-OO language.

Isn't that language called Io, like the natural satellite, and not IO,
like input and output? I ask because I'm not sure -- and I'm too lazy
to Google it right now.
 
C

Chad Perrin

That is one of the most concise statements on the benefits of
duck-typing I've ever read. Thanks, Chad!

You're welcome -- and thanks for the compliment.
 
C

Chad Perrin

=20
We seem to agree even if you think we don't.
=20
"avoiding ... validation before it's convenient" vs. "delayed validatio= n".
=20
"defer rigidity" vs. "dynamic and flexible type validation"
=20
Now where is the difference apart fom wording?

I don't think we disagree. I just said that's what I'd say -- not that
what you'd say is "wrong". Mine seemed a little more descriptive.

--=20
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"It's just incredible that a trillion-synapse computer could actually
spend Saturday afternoon watching a football game." - Marvin Minsky
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top