On Thu, Aug 03, 2006 at 12:01:50AM +0900, J?rgen Strobel wrote:
> On Tue, Jul 25, 2006 at 01:05:11PM +0900, Dumaiu wrote:
> 
> > 	Personally, I feel that Ruby needs more, rather than less, type
> > safety, to balance its natural inclination otherwise and because no
> > amount of 'duck typing' disaffirms that erroneous behavior is best
> > caught as soon as possible.  But I don't think anyone would advocate a
> > return to rigid inheritance checking, which realization the deprecation
> > of type() notably indicates.
> 
> 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?
> 
> 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.

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