On Monday 11 October 2004 10:59 pm, Randy W. Sims wrote:
| Are there any Ruby modules that allow documentation to act as source
| code? I was thinking of the problem of how souce code sometimes diverge
| from its documentation. So maybe there could be a way to specify the
| interface: the number of arguments and their types in the documentation,
| and possibly pre- and post-conditions, and then the documentation would
| be turned into code at runtime. I guess this would be implemented
| something like Perl's source filters[1]. Possibly some constants and
| such could be defined this way as well, version numbers, etc.

With duck-typing this is difficult. I wrote a method probe that tries to 
figure out these method signatures, but it is incomplete because Ruby is not 
100% reflective (at least not from the inside out).

Of course you're talking about putting these in documentation and generating 
code. I suggest maybe going the other way around.

T.