From: Curt Sampson Date: 2005-01-25T19:36:55+09:00 Subject: Re: "Duck Typing" or "No need for abstract classes" On Tue, 25 Jan 2005, Mathieu Bouchard wrote: > Duct-taping as a design philosophy is an obfuscation technique. No, Ruby's implementation of it is the problem. You can do duck typing very much like Ruby does and still have statically checked types; you just need a type inference engine to do that for you. I think that that may actually be the next big step in popular programming languages. A lot of programmers these days expect that they will both never have a memory leak, and never have to track memory allocations and deallocations by hand. So we have garbage collectors. Soon people may see that it's perfectly reasonable to expect to be told at compile time type about type mismatches, and yet not have to keep track of types by hand, in the way that Java forces you to (and prevents duck typing). So add a type inference engine or whatever you need for this. I've given "no type-checking except at runtime" a go for a while now, and I've decided it makes life much harder than it needs to be. ("What can I pass to this? It looks like it wants something that looks kinda like an array, but just how much like an array? Ooops! More than just that much!") It's a heck of a lot easier to use an unfamiliar library in Java than in Ruby, because it's a lot more clear what the methods you're invoking expect you to hand them. Of course, creating something like this is much harder in a language like Ruby where objects are ever-changing and ever-malliable. But even for Ruby it should be possible to do it at least to some extent, falling back to exceptions at runtime if you're doing something tricky (such as adding and removing singleton methods on an object on the fly). cjs -- Curt Sampson +81 90 7737 2974 http://www.NetBSD.org Make up enjoying your city life...produced by BIC CAMERA