Factbites
 Where results make sense
About us   |   Why use us?   |   Reviews   |   PR   |   Contact us  

Topic: Duck typing


Related Topics

In the News (Fri 1 Jan 10)

  
  Duck typing - Wikipedia, the free encyclopedia
In computer science, duck typing is a form of dynamic typing in which a variable's value itself implicitly determines what the variable can do.
Duck typing is a feature of programming languages such as Python, Ruby, and ColdFusion.
Duck typing attempts to limit this flexibility while eliminating a source of possible errors before runtime.
en.wikipedia.org /wiki/Duck_typing   (853 words)

  
 Duck typing vs Structural Subtyping | Lambda the Ultimate
Duck typing seems to have a dynamic connotation, where as structural subtyping is one of the gems of the static ocaml world.
Duck typing includes the strategy of loosely typing records/objects so that two such types are deemed equal if they contain the same set of field names and the fields are of coercible types.
I hadn't taken the concept of coercions to be fundamental to duck typing, instead thinking of them as essentially artifacts of the notion of "duck typing" apparently coming almost exclusively from the dynamically-checked language world.
lambda-the-ultimate.org /node/view/1201   (1541 words)

  
 Hey, I Am A Duck! on iface thoughts
Considering that I had come from the disciplined world of static typing and dynamic typing this idea of duck typing was quite a shock to me when I got introduced to Ruby.
Duck typing is considered as a special form of dynamic typing, but I think it involves a paradigm shift.
In the static typing, dynamic binding and dynamic typing, this interface is explicitly mentioned in the code, whereas it is implicitly used in duck typing.
ifacethoughts.net /2006/09/16/hey-i-am-a-duck   (1480 words)

  
 Duck Typing
Interestingly, this could be used to describe TypeInference as well, in that types are inferred by the operations that are relevant on them, and then that type follows the value around afterward.
Duck Typing allows you to pass an object of any type to a function provided that the object supports a given set of functions and variables.
Insisting that an object have a certain type is the inverse of polymorphism and OO.
c2.com /cgi/wiki?DuckTyping   (1540 words)

  
 Signature Based Polymorphism, Structural Subtyping and Duck Typing | Lambda the Ultimate
The duck typing doesn't really seem to qualify, because it has little to do with typing or subtyping, and is simply an issue of runtime method resolution.
Duck typing is a term usually associated with dynamic (latent / runtime) type languages.
Type classes require a bit of runtime information, but this is not really types but just a vector of functions containing a class' methods (a so-called dictionary) - very akin to vtables in OO, but decoupled from concrete values.
lambda-the-ultimate.org /node/1319   (1817 words)

  
 a little madness » Duck Typing vs Readability   (Site not responding. Last check: 2007-10-14)
Duck typing is getting a lot of attention lately, probably due to the hype buzzing around about Ruby/Rails.
Without type information in the prototype, the only way to know the contracts for sure is to analyse the body of the function.
Duck typing is flat out dangerous, and I think you can leave it at that.
www.alittlemadness.com /?p=28   (2774 words)

  
 Type system - Wikipedia, the free encyclopedia
Type theory studies type systems, although the concrete type systems of programming languages originate from practical issues of computer architecture, compiler implementation and language design.
Type systems that allow polymorphism generally do so in order to improve the potential for code re-use: in a language with polymorphism, programmers need only implement a data structure such as a list or a dictionary once, rather than once for each type of element with which they plan to use it.
A type-checker for a statically typed language must verify that the type of any expression is consistent with the type expected by the context in which that expression appears.
en.wikipedia.org /wiki/Dynamic_typing   (3140 words)

  
 Matt Woodward's Blog   (Site not responding. Last check: 2007-10-14)
Duck typing for the sake of performance should only be done in very specialized circumstances, and I'll probably have more to say on this point soon.
Duck typing is great when you need it, but in the vast majority of cases you care about an object's type (at least philosophically).
Duck typing for performance is a very bad reason to do duck typing, except in specialized circumstances.
mattwoodward.com /blog/index.cfm?CommentID=301   (2742 words)

  
 Duck typing
The term is intended to convey the idea that an object's type is defined by its method signatures rather than by its static type (e.g.
This is standard behavior in late-bound languages like Smalltalk but with some clever usage of Dynamic Proxies, it's possible to do implement duck typing in languages like Java as well.
Note: I was reminded of Duck typing while reading Dave Herman's funny post on Nancy typing.
www.bobcongdon.net /blog/2006/03/duck-typing.html   (144 words)

  
 MonkeyTyping - The PEAK Developers' Center   (Site not responding. Last check: 2007-10-14)
Monkey typing can also potentially form the basis for more sophisticated type analysis and improved program performance, as it is essentially a simplified form of concepts that are also found in languages like Dylan and Haskell.
One type is the "extender", whose purpose is to extend the capability of an object or allow it to masquerade as another type of object.
Type declarations are then used in many languages to indicate what interface is required of an object that is supplied to a routine, or what interface is provided by the routine's return value(s).
peak.telecommunity.com /DevCenter/MonkeyTyping   (5026 words)

  
 Ruby: DuckTyping   (Site not responding. Last check: 2007-10-14)
The interesting notion of "duck typing" has been widely misunderstood and misused.
Duck typing is way of thinking about programming in Ruby.
In Ruby, types are defined as the capabilities of objects.
wiki.rubygarden.org /Ruby/page/show/DuckTyping   (229 words)

  
 Otaku, Cedric's weblog: The Perils of Duck Typing
The idea behind "Duck Typing", which has recently be made popular again by Ruby and other script languages, is to make the concept of types less restrictive.
Java programmers should note, though, that duck typing allows you do things that are so cumbersome in a statically typed language that you don't consider them plausible in the first place, so you don't consider them when you're doing a language comparison.
A fairly obvious reconciliation of the two views on duck typing was the attitude of those of us who put forth the (short-lived) "Smalltalk protocol" idea: explicit abstract data types to hold the interface actually used/expected by real callers.
www.beust.com /weblog/archives/000269.html   (4776 words)

  
 Crossing borders: Typing strategies beyond the Java model   (Site not responding. Last check: 2007-10-14)
In the context of programming languages, duck typing means that if an object responds to the methods of a type, then for all practical purposes, you can treat it like that type.
Exploiting the type system to the fullest and depending on the community to get better metaprogramming support through frameworks instead of rolling your own metaprogramming are both good ways to leverage your advantages.
Duck typing: Dave Thomas explains his definition of Ruby's typing model.
www-128.ibm.com /developerworks/java/library/j-cb05236.html   (3725 words)

  
 The Voidspace Techie Blog
Duck Typing with Python - this is a brief discussion of typing in Python, followed by a rant on duck typing
We say Python is dynamically typed because we pass around references and don't check the type until the last possible minute [1].
The principle of duck typing says that you shouldn't care what type of object you have - just whether or not you can do the required action with your object.
www.voidspace.org.uk /python/weblog/arch_d7_2005_09_03.shtml   (2953 words)

  
 Application Generation: Duck Typing for Performance
According to Sean (and based on both his and Joe Rinehart’s experience in duck typing the core of Fusebox 5 and Model Glue respectively), removing the returntype from methods, and the type and the required="true" from cfarguments can increase application performance.
The main downside is that if you have code that passes an invalid value type in, the error will not be caught at runtime until your application tries to do something with the invalidly typed value rather than on the invalid typed value being passed in.
I like to leave typing in as it more clearly documents the intent of my method interfaces (it is also required for remote interfaces).
www.pbell.com /index.cfm/2006/7/2/Duck-Typing-for-Performance   (497 words)

  
 Application Generation: Duck Typing and Documentation
Adam Haskell has just posted on an interesting approach to duck typing that he mentioned in Sean's talk on the topic yesterday morning.
To briefly summarize, duck typing is an approach to taking advantage of the fact that ColdFusion (like Ruby) is not statically typed.
The problem with this is that if you are only removing types to get the performance boost (there are other use cases for duck typing I'll blog about later), you are left with code that is less readable and less well documented.
www.pbell.com /index.cfm/2006/7/1/Duck-Typing-and-Documentation   (643 words)

  
 An Architect's View - More on Duck Typing
Two things should be seperated here: duck typing and the speedhack as a side-effect of duck typing.
The thing I find more interesting about this recent flurry of attention duck typing is getting (it itself is not interesting at all, in my view, but hey), is that CF performs these very mundane (and very commonly required!) tasks so apparently poorly.
Simply omitting that type attribute in the cfargument, allows ColdSpring to fully manage that dependency, and since you can find out exactly what component is being sent via coldspring.xml, you're not really giving up too much in the documentation arena.
corfield.org /blog/index.cfm/do/blog.entry/entry/More_on_Duck_Typing   (1522 words)

  
 split-s: Quack, quack
Thus, the type of a class is not the same as the class, but typically includes it.
Thus the saying "if it walks like a duck and quacks like a duck, then it must be a duck" or as it is commonly called, Duck typing.
Ruby types are more granular as well, with the method being the atomic component of the type.
split-s.blogspot.com /2005/02/quack-quack.html   (670 words)

  
 [#BOO-246] Implicit duck typing option - jira.codehaus.org
We can create a compiler option to implicitly treat unknown types as type "duck" instead of type "object", so no "as duck" is necessary.
To make implicit duck typing optional, however, we would need to add the option to the Boo compiler (or else implement it as a compiler service like Rodrigo has discussed for other future options).
*Implement implict duck typing for all objects whose generic type is "object." This includes vague statements like "x as object" and when iterating through an Enumerable that returns an object.
jira.codehaus.org /browse/BOO-246   (788 words)

  
 Three Paragraphs on Duck Typing » halostatue
David Vallner: 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.
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.
www.halostatue.ca /2006/08/22/three-paragraphs-on-duck-typing   (372 words)

  
 ooGlossary.com | Duck_Typing   (Site not responding. Last check: 2007-10-14)
Simply put, Duck Typing is a concept that (within CFMX) only applies to CFCs -- the CFMX OO construct.
A "primitive type" in CFMX (like a string, or a number) can't make use of Duck Typing because it has no ability to respond to method calls.
Since ColdFusion uses the contents of a variable to determine what its type should be, all simple types are ultimately strings.
www.ooglossary.com /index.cfm/Duck_Typing   (385 words)

  
 The Visual Editor » Java does Duck Typing
Duck Typing is a powerful feature included primarily in newer languages.
API contracts for duck types are clearly and completely specified up front via Java interfaces.
Duck typing has been made famous by Ruby in the Rails Framework.
www.coconut-palm-software.com /the_visual_editor/?p=25   (1583 words)

  
 HREF Considered Harmful » Blog Archive » Ruby and Strongtalk
Well, even with duck typing, almost all method call sites have a single implementation that’s used way more than any other (say, a default superclass implementation that’s occasionally overridden by subclasses).
Anybody who believes interpreted bytecode languages with duck typing, gc and the like are slow haven’t tried lua.
In this case, the type check isn’t sufficent by itself to ensure the correct method was called.
smallthought.com /avi/?p=16   (3716 words)

  
 Duck Typing Defended   (Site not responding. Last check: 2007-10-14)
I never paid much heed to people who got their knickers in a knot over how dynamic typing is "unsafe".
Let's say you've got duck typing in full swing as in his examples.
Now in the real world it sometimes happens that you choose a common ambiguous word for the duck method, like "run" perhaps, but more often than not you have methods that are named fairly specifically, like "speak" or "jump".
hans.fugal.net /typo/articles/2006/07/08/duck-typing-defended   (543 words)

  
 D. Glossary
The implicit conversion of an instance of one type to another during an operation which involves two arguments of the same type.
Without coercion, all arguments of even compatible types would have to be normalized to the same value by the programmer, e.g.,
An extension of the familiar real number system in which all numbers are expressed as a sum of a real part and an imaginary part.
docs.python.org /tut/node18.html   (1512 words)

  
 A Funny Java Flavoured Look at the World : Weblog
What is Duck Typing and What does Cedric Beust have to do with it
Whilst searching for a bit of blurb about Cedric Beust as he was one of the authors of a Java 5 Features article I typed his name into wikipedia and he had an entry on explaining what Duck Typing is. I have often heard of Duck typing and often wondered what exactly it was.
In computer science, duck typing is a term for dynamic typing typical of some programming languages, such as Smalltalk, where a variable's value itself determines what the variable can do.
jroller.com /page/hoskinator?entry=what_is_duck_typing_and   (241 words)

  
 Tiago Silveira and the world : Weblog
If it looks like a duck, walks like a duck and quacks like a duck, it's a duck.
A duck has defining attributes, say, yellow feathers, a beak, round eyes, etc. Duck typing means recognizing capabilities from an object by its attributes.
Dynamic languages that favour duck typing allow you to shift the development perspective.
jroller.com /page/dukejeffrie?entry=duck_typing_and_refactorings   (438 words)

  
 kiloblog: Duck Typing   (Site not responding. Last check: 2007-10-14)
The B-Tree has two different types of nodes, an inner node and a leaf node.
Both have methods that are similiar, except they operate on different types of objects.
The inner node has a branch object, which is a pairing of an object in the container to test, and a pointer to the next node to visit if the sought object is less than or equal to the test object.
community.livejournal.com /kiloblog/10527.html   (288 words)

Try your search on: Qwika (all wikis)

Factbites
  About us   |   Why use us?   |   Reviews   |   Press   |   Contact us  
Copyright © 2005-2007 www.factbites.com Usage implies agreement with terms.