From: Benjohn Barnes Date: 2006-03-13T08:02:37+09:00 Subject: Re: [RCR] abstract method in Ruby On 12 Mar 2006, at 20:48, Austin Ziegler wrote: *snip* > What you've got is no better than: > > # Every method provided in Enumerable requires that the including > # class defines an #each method that iterates one item at a time. > module Enumerable > def map > arr = [] > each { |elem| arr << yield(elem) } > arr > end > end > > Except that it actually adds a little code for what is essentially a > documentation annotation. As I said, it adds little to no value to > Ruby > and IMO doesn't belong in the core. I still think that kwatch was on to something. It does do more than merely document that the method should be implemented. It describes intention, and provides a uniform and programatic means of doing so. As well as filling in the default function, it could perhaps be used to fill in rdoc generated documentation such that you get a warning about all methods that implementations must provide. Rather than every class that has abstract methods needing to write that documentation and maintain it, it needs to be done once. It's DRYer. I'm sure there are other uses it could be put to, such as interfacing with a static checker if you wanted to build one. :) I'm not saying that I'd necessarily use it either, but I think the idea has merit. It sounds like he's not been put off anyway. If it turns out to be useful over a period of use, and is adopted by some other users, then that's all good and splendid. It's good that people are playing with different ideas that could be useful - it saves me needing to.