[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Duck Typing

Mark Wilson

9/13/2003 8:09:00 PM


On Saturday, September 13, 2003, at 04:01 PM, Michael Campbell wrote:

> [snip]

> Yes. You can do a lot of things with ruby that you can with other
> languages; that it might have some ruby-cultural specific name isn't
> a new phenomenon, is it?

I've seen some adoption of the term among python people recently.

Regards,

Mark


3 Answers

dagbrown

9/13/2003 11:37:00 PM

0

In article <1g18xwi.111fqsa1lnp56oN%lucsky@mac.com>,
Luc Heinrich <lucsky@mac.com> wrote:
: Mark Wilson <mwilson13@cox.net> wrote:
:
: > I''ve seen some adoption of the term among python people recently.
:
: What ? They stole that too ?? :>

No, it''s an invention which is completely original to Guido.
Sheesh.

--Dave

Alex Martelli

9/14/2003 3:11:00 PM

0

Luc Heinrich wrote:

> Mark Wilson <mwilson13@cox.net> wrote:
>
>> I''ve seen some adoption of the term among python people recently.
>
> What ? They stole that too ?? :>

I would claim independent invention, given that my post of Jul 2000
to c.l.py where I mused:
"""
In other words, don''t check whether it IS-a duck: check
whether it QUACKS-like-a duck, WALKS-like-a duck,
etc, etc, depending on exactly what subset of duck-like
behaviour you need to play your language-games with. If
the argument fails this specific-ducklyhood-subset-test, then
you can shrug, ask "why a duck?" (at least, you can if you''re
a Marx Brothers fan and have memorized "Cocoanuts"'' script;
Monty Python one-true-wayists will have to find their own
simile here), and move on to the next set of tests (why-a-no-
chicken immediately comes to mind, but then one would have
to ask why it crosses the road, so I think we''d better snip it).
"""

was done before I had ever heard of Ruby, and explained as
"""
My instinctive approach (and it may be that I still haven''t
developed the "right" Python instincts, because I haven''t
been using it long!)
"""

while the first mention I can find in comp.lang.ruby is in
a Jan 2001 post by Ben Tilly:
"""
Imagine a language where you are constantly telling the
language everywhere that you have a duck because it is
walking like a duck and talking like a duck. This is
built into everything that you do. Then suddenly you
find out that it isn''t really a duck after all.
"""

Of course, it''s quite possible that Google Groups'' archive
is incomplete for either or both languages.


Alex

Kent Dahl

9/14/2003 4:07:00 PM

0

Alex Martelli wrote:
> If
> the argument fails this specific-ducklyhood-subset-test, then
> you can shrug, ask "why a duck?" (at least, you can if you''re
> a Marx Brothers fan and have memorized "Cocoanuts"'' script;
> Monty Python one-true-wayists will have to find their own
> simile here), [...]

I wonder whether Python people will revert to witch-typing, since it
lends itself so nicely to comparision with duck-typing. ;P

Not to mention varieties of other old classics:
- "What kind of typing does your program use?"
- "Witch typing."
- "Gah, you grammar nazi. Ok, WHICH kind of typing does it use?"
- "Witch typing."
- "I''m asking YOU! Which typing!?!?"
- "Yes, witch typing."
- *cue Homer Simpson mode* "Why you little..."
- *choke, gargle*

--
(\[ Kent Dahl ]/)_ _~_ _____[ http://www.pvv.or... ]_____/~
))\_student_/(( \__d L b__/ (pre-) Master of Science in Technology )
( \__\_&#245;|&#245;_/__/ ) _)Industrial economics and technological management(
\____/_&#246;_\____/ (____engineering.discipline_=_Computer::Technology___)