doc icon indicating copy to clipboard operation
doc copied to clipboard

Should the "returns" (plural) keyword link to "Type Constraint" in docs index?

Open jubilatious1 opened this issue 5 years ago • 6 comments

The problem

Typing the word returns into the search box on the docs.raku.org home page does not bring up a link to the use of the "returns" keyword that enables a Type Constraint in a Signature. It only brings up a link to the .return Method page here: https://docs.raku.org/routine/returns

New users in particular may need to quickly see and compare returns (used as a type constraint) versus return (used for control flow), to understand which one is used where.

Suggestions

Add an index entry such that typing the keyword returns (plural) into the docs.raku.org home page links to the appropriate subheading on the Signature page here: https://docs.raku.org/type/Signature#returns

Optional Section:

Looking at the bigger picture, is there a need to create an index category possibly entitled "Reference (constraint)" or "Reference (Type Constraint)" where similar keywords/symbols like --> , return type arrow , returns , of and prefix(C-like) form can all reside?

jubilatious1 avatar Jan 30 '20 09:01 jubilatious1

Typing the word returns highlights the word returns under the method category and the link points to the Signature page https://docs.raku.org/type/Signature#returns .

For the optional section, there's already a section Return type constraints under the Functions page.

uzluisf avatar Jan 30 '20 16:01 uzluisf

That's not what I see when I type returns into the search box on docs.raku.org . I only see a single instance of the full word returns showing up under the sub-heading "methods", which links to the page https://docs.raku.org/routine/returns . Screenshot below [Firefox 72.0.2 (64-bit) "Your Firefox is up to date"] :

Screen Shot 2020-01-30 at 08 24 57

There is no other choice for returns than the "method" category that leads to https://docs.raku.org/routine/returns , and AFIAK none of the other links in that dropdown lead to https://docs.raku.org/type/Signature#returns .

FYI, I can link to the appropriate subheading on the https://docs.raku.org/type/Signature page by searching for --> or the full three-word term Return type arrow but not if I type in the keyword returns.

jubilatious1 avatar Jan 30 '20 17:01 jubilatious1

I just tried a search on "returns" and I could see it automatically strip the "s" and then the page for "return" came up.

If I type in "returns" and don't immediately hit return, I can select "returns" out of the menu that drops down.

doomvox avatar Jan 31 '20 01:01 doomvox

That might be a bug...

JJ avatar Jan 31 '20 12:01 JJ

@jubilatious1 Now I see. From what I understand, whenever you type returns you'd also like to see a suggestion under the Reference category that links to returns.

@JJ Wouldn't adding the anchor X«|returns» in Signature.pod6 solve this issue?

uzluisf avatar Feb 03 '20 20:02 uzluisf

@uzluisf Thank you! That's what I'm trying to say--that the drop-down list should be populated with at least two (2) choices for the keyword returns : Method => returns , and Reference => Signature literal . [ The '=>' indicates dropdown list navigation ]. The second link could be made directly to: https://docs.raku.org/type/Signature#returns .

Also, this returns 'word category' needs to be cleaned up: there shouldn't be so many choices populating the dropdown list, as many are spurious matches. For example, (using the screenshot above), I navigated the dropdown list to Reference => require and was taken to the 'require' subheading on the Modules page: https://docs.raku.org/language/modules#index-entry-require . That page looks fine but the returns keyword doesn't appear in any code on that entire page.

I see a similar problem with Reference => Futures , syntax => require , method => feature , method => parents , method => restore , and method => rethrow . The keyword returns does not appear as part of the code on those respective pages.

AFAIK, returns should only link to doc pages like Reference => Signature literal , method => returns , class => Routine , and also should cross-reference to pages with the --> synonym. I'm sure I'm missing a link or two, but that's for starters.

jubilatious1 avatar Feb 03 '20 21:02 jubilatious1