Luke Palmer wrote:
Supposing I had a "doc" trait, could I say:
   sub f2c (Num $temp doc<Temperature in degrees F>)
       doc<Convert degress F to degrees C>
   {...}
Or would I be forced to spell it  doc('stuff')  ?
Well, first you need an `is` somewhere in there.  And after that I think
you'll need to do it in doc('stuff') form.  If we did allow doc<>, then
this:

A word of warning...

Perldoc[*] will eventually support this sort of thing, for sure.  But it
will lead to the unfortunate side effect that your code needs to at
least compile without syntax errors, and without too many obscene
mistakes - so that these traits are accessible by the dialect that
interprets them into a Perldoc tree.

That's if you care about seeing the information presented nicely when
you use `perldoc Foo', of course.

Sam.

* - the project aiming to provide dialect-agnostic inline documentation
    for Perl 5 and Perl 6.  The Perl 5 prototype is on CPAN... still in
    early stages.

Reply via email to