From: "Calvelo Daniel" <dcalvelo / pharion.univ-lille2.fr>
>
> [....]
>
> Sorry to introduce Python, but I'm not yet comfortable enough with Ruby.
> You have this feature Python. If you declare in file aModule.py:
>
> # aModule.py
> def aFunc(anArg):
>   " A string right after the declaration. It is a 'docstring'."
>   print "hi"
>
> Then, in the interactive Python interpreter:
> >>> import aModule
> >>> print aModule.aFunc.__doc__
>  A string right after the declaration. It is a 'docstring'.

This could be implemented in Ruby:

class Object
   DOC = []
   def Object::doc( method_name, doc_string=nil )
      if doc_string == nil then
         DOC[method_name]
      else
         DOC[method_name] = doc_string
      end
   end
end



class AClass

   Object::doc :aFunc, " A string right after the declaration. It is a
'docstring'."
   def aFunc(anArg)
      print "hi"
   end

end

print AClass::doc(:aFunc)    #=> A string right after ....

--------

Of course this is not so nice like the docstrings in Python, but better than
nothing...
If I could alias "Object::doc" to only "doc" it would be much better.



Regards
  Michael