ara.t.howard / noaa.gov wrote: > On Mon, 3 Apr 2006, Trans wrote: > >> def foo( x : String ) >> ... >> end >> >> def foo( x : Int ) >> ... >> end >> >> seems to me a much more readible and versitile way of handling the >> cases, irregardless of any contractual beneifits. > > not to mention that rdoc can then generate a doc block for 'what foo > does with > ints' and 'what foo does with strings'. with duck typing these get rolled > into one block and it's strictly up to the comments to reveal the > distiction. If foo is implemented in duck type style, should it even say what it does with int, string, etc.? Isn't it better for the foo comment to say something like "#foo doesn't care what x is, except that when you #frobble it, the result is something that can #zurgle." But, terminology aside, I agree... if, as sometimes happens, you just *have* to switch on the class of x in foo, it would be nice to make it explicit in a way that rdoc can understand. This can be done crudely today, by calling a different method (foo_int, foo_string) in each of the _when_ clauses. Hey, maybe rdoc could be modified to look for 'case x', if an argument is x, and extract comments from before each _when_ clause. That is not totally unprecedented, since rdoc looks for 'yield result' inside the def..end. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407