Skip to content
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

Special variable (Cursor) is not documented #1760

Closed
samcv opened this issue Feb 7, 2018 · 10 comments
Closed

Special variable (Cursor) is not documented #1760

samcv opened this issue Feb 7, 2018 · 10 comments
Labels
docs Documentation issue (primary issue type) NOTSPECCED need roast tests before documenting

Comments

@samcv
Copy link
Collaborator

samcv commented Feb 7, 2018

Only https://design.perl6.org/S05.html mentions it.

@fluca1978
Copy link
Contributor

Uhm..it also states that the match object and the cursor start the same in the beginning of the closure, but apparently I'm not able to get it:

> '123' ~~ / (\d) { say $0; say $¢; } \d+ /;
「1」
Nil

Also I'm not sure if such variable has to be documented at all, since it seems to me a little too much "magical" and the documentation for the Cursor states:
A user-space program usually doesn't need to deal with Cursor objects, just with their relatives, Match objects.

@JJ
Copy link
Contributor

JJ commented Feb 8, 2018

They might be useful in Grammars, for instance. So it might be necessary to document them, at least. However, it might also be necessary to find now what they actually do in the current implementation.

@coke coke added the docs Documentation issue (primary issue type) label Feb 9, 2018
@JJ
Copy link
Contributor

JJ commented Feb 19, 2018

It does not seem to move:

 '123' ~~ / (\d) { say $/; say $¢; } (\d+) { say $/; say $¢; }/;

yields

「1」
 0 => 「1」
Nil
「123」
 0 => 「1」
 1 => 「23」
Nil

Is it maybe a not-yet-implemented feature?

@JJ
Copy link
Contributor

JJ commented Feb 19, 2018

In fact, Cursor is initalized like Match: https://github.com/rakudo/rakudo/blob/b07e7b1d0ffcafc1f9dfbb3d56eff59c8eaddbf8/src/core/Cursor.pm#L1
Nothing else. Looks to me NYI

@JJ
Copy link
Contributor

JJ commented Feb 19, 2018

Or maybe even won't be implemented; https://github.com/rakudo/rakudo/blame/b07e7b1d0ffcafc1f9dfbb3d56eff59c8eaddbf8/src/core/Cursor.pm#L1
The commit line talks about "Cursor/Match unification"

@samcv
Copy link
Collaborator Author

samcv commented Feb 19, 2018

Hmm. Maybe this means that it should be removed or a deprecation warning added and then removed? If it's not documented/used anywhere.

@coke
Copy link
Collaborator

coke commented Feb 20, 2018

This variable does appear in a 6.c-errata test file.

@AlexDaniel AlexDaniel added the NOTSPECCED need roast tests before documenting label Feb 20, 2018
@AlexDaniel AlexDaniel mentioned this issue Mar 3, 2018
AlexDaniel referenced this issue in AlexDaniel/raku-golf-cheatsheet Mar 12, 2018
@JJ JJ closed this as completed in b94f678 Jul 25, 2018
@JJ
Copy link
Contributor

JJ commented Jul 25, 2018

Behavior now is different, BTW:

 m:  '123' ~~ / (\d) { say "» / »", $/; say "» ¢ »", $¢; } (\d+) { say  "» / »", $/; say  "» ¢ »", $¢; }/;  
 jmerelo, rakudo-moar a71e370bb: OUTPUT: «» / »「1」␤ 0 => 「1」␤» ¢ »「1」␤ 0 => 「1」␤» / »「123」␤ 0 => 「1」␤ 1 => 「23」␤» ¢ »「123」␤ 0 =>  「1」␤ 1 => 「23」␤»

@AlexDaniel
Copy link
Member

Are we all satisfied with the docs? I thought is now identical to just $/ after TimToady++'s recursor work. Am I wrong? Also, didn't we have a plan to remove ?

@AlexDaniel AlexDaniel reopened this Jul 25, 2018
@JJ JJ closed this as completed in fc50ce3 Jul 25, 2018
@JJ
Copy link
Contributor

JJ commented Jul 25, 2018

No, it's not the same as $/. Outside the regex, $/ contains the match object, $¢ is nil. Can add that to the documentation if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation issue (primary issue type) NOTSPECCED need roast tests before documenting
Projects
None yet
Development

No branches or pull requests

5 participants