The duck's backside

Hi –

On Tue, 3 Jun 2008, Enrico F. wrote:

David A. Black [email protected] wrote:

Dave T., who coined the term “duck typing”, has described it as
“a way of thinking about programming in Ruby.”

Do you know when he actually started speaking about “duck typing”?

No, I don’t know exactly when it was.

David

On Mon, Jun 2, 2008 at 5:07 PM, Rick DeNatale [email protected]
wrote:

And his description of Eiffel, “Quintessentially French!”
Do you mean it works like the TGV but nobody really knows why? Ok I
guess I have to leave my wife’s country now ;).
Robert

On Mon, Jun 2, 2008 at 12:54 PM, Enrico F. [email protected]
wrote:

Dave T., who coined the term “duck typing”, has described it as
“a way of thinking about programming in Ruby.”

Do you know when he actually started speaking about “duck typing”?

Did he? I learned the term in connection with Python, a long long
time ago. The wikipedia article on duck typing seems to support the
idea that the term comes from that camp:

Marcelo

I think “duck typing” might be older than python as well

On Mon, Jun 2, 2008 at 5:07 PM, David A. Black [email protected]
wrote:

I could be wrong about Dave having coined it. If it walks like a
coinage and talks like a coinage… :slight_smile:

Well, whoever coined “Duck Typing”, I personally claim coinage of
“Chicken
Typing” on October 22, 2007:
http://talklikeaduck.denhaven2.com/articles/2007/10/22/chicken-typing-isnt-duck-typing


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

Hi –

On Tue, 3 Jun 2008, Marcelo wrote:

Duck typing - Wikipedia

I could be wrong about Dave having coined it. If it walks like a
coinage and talks like a coinage… :slight_smile:

David

David M. wrote:

Give me an example of a class that isn’t a category.

It might not be a category as far as your program logic is concerned, but it’s
certainly a category of some kind. NilClass is a category of objects for whom
#nil? returns true, for example.

class MyNil
def nil?
true
end
end

p MyNil.new.nil?

On Monday 02 June 2008 08:13:22 Robert D. wrote:

designs. I do not know what others do, but the simple fact that I use
Ruby classes for other things falsifies your statement.

Give me an example of a class that isn’t a category.

It might not be a category as far as your program logic is concerned,
but it’s
certainly a category of some kind. NilClass is a category of objects for
whom
#nil? returns true, for example.

Hi –

On Tue, 3 Jun 2008, Rick DeNatale wrote:

Dave T., who coined the term “duck typing”, has described it as
Duck typing - Wikipedia

I could be wrong about Dave having coined it. If it walks like a
coinage and talks like a coinage… :slight_smile:

Well, whoever coined “Duck Typing”, I personally claim coinage of “Chicken
Typing” on October 22, 2007:
http://talklikeaduck.denhaven2.com/articles/2007/10/22/chicken-typing-isnt-duck-typing

And I’ll take “stereotyping” :slight_smile:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/85486

David

On Tue, Jun 3, 2008 at 2:03 AM, David M. [email protected]
wrote:
I know I do not have the communication talents of Joël and David, well
he’s kind of cheating, it is his profession ;). But I really fail to
understand your reasoning, as a matter of fact Joël’s code was not
modifiying the category animal but human.
Maybe reading the link David gave above will help you to understand
our mindset, well we do not even have exactly the same either, which
is a good thing :).

But that does not mean that you have to adapt it of course!!!

Cheers
Robert

http://ruby-smalltalk.blogspot.com/


Whereof one cannot speak, thereof one must be silent.
Ludwig Wittgenstein

Rick DeNatale wrote:

Well, whoever coined “Duck Typing”, I personally claim coinage of “Chicken
Typing” on October 22, 2007:
http://talklikeaduck.denhaven2.com/articles/2007/10/22/chicken-typing-isnt-duck-typing

I hereby claim “turducken typing”, but I have no idea what it means. :wink:

On Monday 02 June 2008 17:48:38 Joel VanderWerf wrote:

David M. wrote:

Give me an example of a class that isn’t a category.

It might not be a category as far as your program logic is concerned, but
it’s

certainly a category of some kind. NilClass is a category of objects for
whom

#nil? returns true, for example.

class MyNil
def nil?
true
end
end

p MyNil.new.nil?

Interesting that this works – but it doesn’t disprove my point. Humans
are a
category of mammals – that doesn’t imply that all mammals are humans.

Now, technically, you should be able to do it the other way around,
right?

class NilClass
def nil?
false
end
end

That would make my statement invalid. But doing so is evil:

$ irb
irb(main):001:0> # Control statement
irb(main):002:0* true
=> true
irb(main):003:0> class NilClass
irb(main):004:1> def nil?
irb(main):005:2> false
irb(main):006:2> end
irb(main):007:1> end
=>
irb(main):008:0> # Another control statement… can we make it that far?
/usr/lib/ruby/1.8/irb/slex.rb:235:in match_io': undefined methodcall’
for
nil:NilClass (NoMethodError)
from /usr/lib/ruby/1.8/irb/slex.rb:222:in match_io' from /usr/lib/ruby/1.8/irb/slex.rb:76:inmatch’
from /usr/lib/ruby/1.8/irb/ruby-lex.rb:287:in token' from /usr/lib/ruby/1.8/irb/ruby-lex.rb:263:inlex’
from /usr/lib/ruby/1.8/irb/ruby-lex.rb:234:in
each_top_level_statement' from /usr/lib/ruby/1.8/irb/ruby-lex.rb:230:inloop’
from /usr/lib/ruby/1.8/irb/ruby-lex.rb:230:in
each_top_level_statement' from /usr/lib/ruby/1.8/irb/ruby-lex.rb:229:incatch’
from /usr/lib/ruby/1.8/irb/ruby-lex.rb:229:in
each_top_level_statement' from /usr/lib/ruby/1.8/irb.rb:146:ineval_input’
from /usr/lib/ruby/1.8/irb.rb:70:in start' from /usr/lib/ruby/1.8/irb.rb:69:incatch’
from /usr/lib/ruby/1.8/irb.rb:69:in `start’
from /usr/bin/irb:13

Marcelo [email protected] wrote:

Did he?

No. As far as I know, he did not.

Joel VanderWerf wrote:

Rick DeNatale wrote:

Well, whoever coined “Duck Typing”, I personally claim coinage of
“Chicken
Typing” on October 22, 2007:
http://talklikeaduck.denhaven2.com/articles/2007/10/22/chicken-typing-isnt-duck-typing

I hereby claim “turducken typing”, but I have no idea what it means. :wink:

Proposed definition: code that combines chicken and duck typing and
makes the programmer look like a turkey.

On Mon, Jun 2, 2008 at 8:03 PM, David M. [email protected]
wrote:

Interesting that this works – but it doesn’t disprove my point. Humans are a
category of mammals – that doesn’t imply that all mammals are humans.

Humans are a category of animal with certain characteristics which set
them apart form other animals. All animals which have those
characteristics are human. You stated the theory that the NilClass
class encompasses all objects that respond positively to #nil?. Which
is easily disproved by defining a non-NilClass which responds
positively to nil. MyNil is in the category of objects which
respond to #nil? in the affirmative, but not in the class NilClass.
Thus, NilClass != the category of objects which respond to #nil?

NilClass objects may be a subset of the #nil? => true category, but
NilClass itself does not define a category other than “objects which
are instances of NilClass”.


Avdi

Home: http://avdi.org
Developer Blog: Avdi Grimm, Code Cleric
Twitter: http://twitter.com/avdi
Journal: http://avdi.livejournal.com