On 2005-01-16, Sam Roberts <sroberts / uniserve.com> wrote:
> irb can be extended to support ri, why isn't this better than
> docstrings?

So then, why open-uri, you have curl, don't you?

Things work better when they are integrated, and there is no need to
serialize and de-serialize all the time.

If you just want to dump out the basic documentation, ri is good enough.

But consider the following behaviour of ri: if you do "ri aClass", it
shows you a summary of the purpose of the class, and the list of the
class/instance methods, nothing more. If you do "ri aClass#some_method",
it shows you the description of that specific method.

That ri does so hardcoded. What if you want to see the description of
the class and all of the class/instance methods together? You can hack
such an option on ri if it's not there yet, but it's a rigid model
anyway. The user should be able to display/process docs in a customised
way with the well-known feeling of easiness ruby gives you in general.

With docstrings, it would be a one-liner to dump out all the stuff about
the class and it's methods. You could easily search the docs as well in
a very high-level fashion.

You could interact with docs in a programmable way.

* * *

And there were no problems about docs not being installed. Eg., I check
out a new package foo. I don't want install it as I don't know whether I
like it or not. I just do 

"tar xvzf foo.tar.gz && cd foo && irb -r ./foo.rb"

What an ease it were if I could access the docs right then from irb!

I thought ruby's philosophy is "everything is an object, unless there is
a good reason for the opposite". Docs should be objectified as well. 

Csaba