doc icon indicating copy to clipboard operation
doc copied to clipboard

Declarators don't know the name of attributes in p6doc

Open Altreus opened this issue 7 years ago • 8 comments

The problem

If I try to use declarator syntax to document an attribute, p6doc doesn't know what to call it:

unit class TestClass;
#| Absolutely imperative you supply this
has $.prop is required;

p6doc TestClass.pm

class Attribute.new
Absolutely imperative that you supply this

(I was advised this is the correct repo to report problems with the p6doc program itself. Hope it is so.)

Altreus avatar Aug 16 '18 15:08 Altreus

Yep, p6doc is hosted here. Thanks a lot for the report!

JJ avatar Aug 16 '18 15:08 JJ

This may be a Rakudo pod 6 issue.

tbrowder avatar Aug 16 '18 18:08 tbrowder

@tbrowder can you please clarify?

JJ avatar Aug 20 '18 16:08 JJ

It looks like a problem with p6doc to me, not the rakudo pod parser.

tbrowder avatar Aug 20 '18 17:08 tbrowder

Currently p6doc internally calls perl6 --doc which produces the same result as described by @Altreus:

Given the test file TestClass.pm6:

unit class TestClass;
#| Absolutely imperative you supply this
has $.prop is required;

Using p6doc:

$ p6doc TestClass.pm6
class Attribute.new
Absolutely imperative you supply this

Using perl6 --doc:

$ perl6 --doc TestClass.pm6
class Attribute.new
Absolutely imperative you supply this

Thus I'd assume the problem does not root in p6doc, or am I misunderstanding something?

noisegul avatar May 29 '19 06:05 noisegul

@tbrowder @noisegul what we have to find out is if this is a documentation error or (as in, there should be a line break between the definition of the class and the documentation for the attribute) or a pod error (as in, #| should always document what's next, never what's above). What do specs say?

JJ avatar May 29 '19 07:05 JJ

Or if #! can be used to document attributes at all. I wouldn't be so sure it does.

JJ avatar May 29 '19 07:05 JJ

With p6doc spun off, what's left for this ticket in this repo?

coke avatar Apr 16 '22 16:04 coke

Perhaps it could be migrated.

2colours avatar Mar 03 '23 08:03 2colours

If I try to use declarator syntax to document an attribute, p6doc doesn't know what to call it

Putting p6doc aside, note this:

class foo {
  #| bar doc
  has $bar
}

.say for $=pod[0], $=pod[0].WHEREFORE;

displays

bar doc
Mu $!bar

raiph avatar Mar 05 '23 22:03 raiph