New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Usage" section seems useless to reader #794
Comments
|
I'm more with having the actual signature (pretty much as in the declaration,) and then if necessary some example (or examples,) that show it being used with some example output. |
|
IIRC @dha started adding those They do seem redundant, though personally I'd be OK if those were replaced with actual usage; that is actual code examples, rather than |
|
I was the one who raised that concern originally. I believe they are intended to address the issue that to truly understand the signature presented in a perl 6 routine, you might have to understand a lot of extra syntax; The simplified approach is supposed to make it easier to understand. My concern is that we already have to explain all the details of how signatures work; now we may also have to explain all the details about the USAGE blocks work. I am fine with going all out with USAGES where needed, but I think we need to document the docs in that case. If we end up just using function signatures, then we should have quick links/popups to "what this signature means" that are automatically generated. The current situation with some USAGES and some not is confusing. |
|
I believe that actual working examples will be more useful than just repeating of Automatically generated signature explanations is not an easy task. I think, we'd better to create/to point to a page with general signatures explanation. We already have subroutines page, where all the details of possible signatures explained. |
|
The "confusing signatures" could be somewhat alleviated by a link of some sort to the signature documentation which IIRC is quite complete (or should be by now.) |
|
It seems to me that:
Has some real usability problems as docs, but it should be easily translated into something much more docish. Some rules I'd propose:
So the example becomes:
I'd suggest that's quite readable, but all of the transformations are pretty straightforward (heck, we could build it into Signature as something like |
|
I agree that we should have more useful examples. “Usage” section will indeed have less value if we provide enough useful examples. multi sub split( Str:D $delimiter, Str:D $input, $limit = Inf,
:$skip-empty, :$v, :$k, :$kv, :$p) returns Positional |
|
I really don't like the idea of using things like |
|
They are easier to use mainly because they offer less info. sub split($delimiter, $string, :$limit, :$v, :$k, :$kv, :$p, :$skip-empty) is much easier to read too. |
|
@ajs let's see. Trailing It's not the talk about an actual signatures, I suppose, they should be untouched. It's the documentation, not a language tutorial. |
|
@pmurias I know, you are right. But people trying to learn Perl 6 want something readable to get started, and my point is that “usage” section is not as useless as this issue seems to suggests. It does offer less info, but sometimes that's what you want and need. However, examples are even more useful, if done correctly. I don't mind “usage” sections go. |
|
Hovering explanations could help people learn. |
|
Don't add {} to sig code. Tag the block and make the test smart enough to add the {} for you |
|
@coke it's a good idea, thanks. |
…nt type documentation to it's usage instead of brackets addition. See #794 (comment)
- Many of obsolete due to #794 "Usage" sections were removed or updated with examples(not for all files for now, but for about a half). - Usage sections of Cool and Channel pages were replaced with examples. - Examples for the Cool documentation page were updated and expanded. - Type documentation files that start with a 'C' letter are compilable now.
|
My two cents:
|
|
@smls |
|
IIRC I autogenerated the IO::Spec docs about a year ago, so it is entirely possible that the actual methods have changed in the meantime. |
|
@jonathanstowe then it's a time for a new issue for someone to investigate/write/test these pages. |
|
With 3029fc1075 last "Usage" sections were removed(you can still grep a few, but they are mostly needed). |
|
As zoffixznet and coke pointed out, this was my work. When coke raised objections, I stopped, but when that happened, I asked if i should remove the usage statements and the response was, "no, don't do that yet" and that was where, AFAIK, it was left. The discussions about it left me with the following feeling about this general area of documentation: Use the actual signatures, and have sufficient (fsvo) examples in the actual documentation, rather than usage statements. This, however, would, IMO, require very detailed documentation of signatures. jonathanstowe indicates that he thinks such documentation is currently complete, but, as I've been somewhat busy lately and out of the loop, I am not aware of that being the case. A quick look at docs.perl6.org does not have information on signatures jumping out at me, so I'm skeptical on that point. In any case, if we can have an explicit, obvious, and complete Signatures documentation page, I see no reason why the usage statements can't be removed. And I'll be happy to be the one to do that if we have actual agreement on that point. |
|
And now I see that I missed the comment indicating that they have, in fact, mostly been removed and this issue closed. Blah. I was about to question Altai-man's comment that "you can still grep a few, but they are mostly needed" on the basis of why they'd be needed, but a quick grep shows that they all seem to be gone. shrug I guess I'll shut up now. |
|
@dha First four matches are false positives, I wasn't able to come up with a good example for About your words about the signatures - yes, I'm completely agree with you in the point that we need a good Signature page documentation. Personally, I don't think that we need signatures explanation in popups, but I'm not against it, so if someone wants to implement such a feature - don't be afraid to open a new issue or even pull request. Thanks for your comments! |
In some documentation files we have "Usage" section, like this:
Judging by grep, we have about 300 occurrences of such "examples". But, eh, is it really useful?
If we explain some method or subroutine, I think, anyone, who reads documentation, do know how to apply subroutines and call methods. For a method it's just
value.method-name(maybe-some-args)- this formula doesn't change with every section, we just repeat useless stuff. We don't have any output example to be really useful for anyone in such sections, too. If we apply a function, it'll almost always(yes, perl 6 has many ways to call a subroutine, but that's not the case) besub-name(value, some-other-args).Is it me or this "Usage" sections are a bit redundant?
Secondly, because we have "fake" arguments there, like "PAIR" or "FORMATSTRING', it is impossible to check them with a compiler. I think, if we want to really show some usage, we need to rewrite all such strings as a proper examples, if we not, we need to remove such sections.
The text was updated successfully, but these errors were encountered: