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

Document $; #2642

Closed
ElenaMerelo opened this issue Mar 2, 2019 · 10 comments
Closed

Document $; #2642

ElenaMerelo opened this issue Mar 2, 2019 · 10 comments

Comments

@ElenaMerelo
Copy link
Collaborator

The problem

The C<$;> variable is only in 5to6-perlvar doc.

Suggestions

It would be good if it had its own doc, in Variable.pod6 for instance

@lichtkind
Copy link
Contributor

because its deprecated, see: #2632

@JJ
Copy link
Contributor

JJ commented Mar 3, 2019 via email

@b2gills
Copy link
Contributor

b2gills commented Mar 3, 2019

There is no $; variable in Perl6.

It is an anonymous state variable $, followed by the statement terminator ;.

my $a := $;    my $b := $; # two separate $ variables

$a = 1;
say $b; # (Any)
my $c := $_;    my $d := $_;

$c = 3;
say $d; # 3
say ++ $ for ^3
# 1
# 2
# 3

If you tried to use it in a string you get a compilation error.

" $; "
# ===SORRY!=== Error while compiling:
# Non-variable $ must be backslashed

So the only place it really makes sense to talk about it is in 5to6-perlvar.

@JJ
Copy link
Contributor

JJ commented Mar 3, 2019 via email

@AlexDaniel
Copy link
Member

AlexDaniel commented Mar 3, 2019

According to the raku-golf-cheatsheet repo, there's only $/ and $! (+ anonymous state vars). is also mentioned but it's more internal and I don't know if it should be documented. Everything else is not a variable :)

@JJ
Copy link
Contributor

JJ commented Mar 3, 2019 via email

@AlexDaniel
Copy link
Member

AlexDaniel commented Mar 3, 2019

Oh, the parser does attempt to detect the use of these variables. For example:

$; = 42
===SORRY!=== Error while compiling -e
Unsupported use of $; variable; in Perl 6 please use real multidimensional hashes
at -e:1
------> $;⏏ = 42

@JJ
Copy link
Contributor

JJ commented Mar 3, 2019 via email

@AlexDaniel
Copy link
Member

Not really, no. IMO these error messages shouldn't even be enabled by default (you should only see them with use training-wheels <perl5>).

@coke
Copy link
Collaborator

coke commented Mar 13, 2019

Given that this is only part of the 5 to 6 training wheels, I think it's OK that it's only listed on the 5 to 6 page, and that it's not indexed. (it is findable if you use the search site option). The documentation on this page says:

The subscript separator variable is not included in Perl 6. Frankly, if your Perl 5 code is using this, it's almost certainly really, really old.

Closing ticket.

@coke coke closed this as completed Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants