develooper Front page | perl.perl6.language | Postings from June 2007

Re: POD <-> Code entanglement

Thread Previous | Thread Next
From:
Juerd Waalboer
Date:
June 14, 2007 08:47
Subject:
Re: POD <-> Code entanglement
Message ID:
20070614154545.GN27745@c4.convolution.nl
Thomas Wittek skribis 2007-06-14 17:18 (+0200):
> So maybe directives like method, sub, attribute, class etc. might be a
> better choice regarding semantics.

Yes, a better choice indeed. But I would still not be happy with it,
because there would still be a lot of code duplication.

    method foo (:$bar = 5) { ... }

I don't want to have to mention *again* that the thing is a "method",
and that it is called "foo", that it has a "named argument" identified
as "$bar", which defaults to 5.

This is why I (long time ago) suggested "is documented". Like Mark, I do
not really care about the actual syntax much:

    method foo is documented("Foos its argument interactively")
    (
        :$bar = 5 is documented("Object to be fooed"),
        # I'm not sure about the precedence of "is".
    ) {
        ...
    }

The backtick is rather cute and saves a lot of typing. It's like a
comment (#), but ends up as *external* documentation. That's nice.

> Semantics are very useful in documentation, why throw them away?

Why not have both? With normal POD as suggested by Damian, you could
still generate it from something else. A few macros could help ignore
the inline documentation.
-- 
korajn salutojn,

  juerd waalboer:  perl hacker  <juerd@juerd.nl>  <http://juerd.nl/sig>
  convolution:     ict solutions and consultancy <sales@convolution.nl>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About