[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Duck Typing?
- From: Francisco Olarte <folarte@...>
- Date: Tue, 31 Jul 2018 11:59:57 +0200
Gavin:
On Tue, Jul 31, 2018 at 11:48 AM, Gavin Wraith <gavin@wra1th.plus.com> wrote:
> I hear the phrase "Duck Typing", in what I guess may be a
> dismissive description of Lua's type system and possibly
> a mysterious reference to "Duct Tape".
It's not dismissive, and does not come from Duct Tape. It comes from
"if it walks like a duck, swims like a duck and quacks like a duck it
then must be a duck". I'm pretty suer wikipedia and the likes have
articles on it if you want to read more.
It describe a form of "typing" objects used in many languages which
have typing system similar to lua, where objects have a kind of
dictionary where you can add values/functions in many way, and where
functions/methods do not check "object inheritance", they just call (
or use or check ) the passed object has the methods/properties it
needs, and does not bother how it adquired them.
Francisco Olarte.