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

__CLASS__ doesn't issue an experimental warning #22288

Open
ikegami opened this issue Jun 16, 2024 · 2 comments
Open

__CLASS__ doesn't issue an experimental warning #22288

ikegami opened this issue Jun 16, 2024 · 2 comments

Comments

@ikegami
Copy link
Contributor

ikegami commented Jun 16, 2024

tags: 5.40.0 core class experimental warnings

__CLASS__ doesn't issue an warning identifying it as experimental like class, field, ADJUST, etc do.

$ perl -v | grep 'This is'
This is perl 5, version 40, subversion 0 (v5.40.0) built for x86_64-linux-thread-multi

$ perl -e'use feature qw( class ); class Foo { }'
class is experimental at -e line 1.

$ perl -e'use feature qw( class ); field'
field is experimental at -e line 1.
Cannot 'field' outside of a 'class' at -e line 1.

$ perl -e'use feature qw( class ); ADJUST { }'
ADJUST is experimental at -e line 1.
Cannot 'ADJUST' outside of a 'class' at -e line 1.

$ perl -e'use feature qw( class ); __CLASS__'
Cannot use __CLASS__ outside of a method or field initializer expression at -e line 1.

It's moot since it can't be used outside of class and using class does warn, but it's inconsistent with other such keywords, and it could become important if class stops being experimental before __CLASS__.

@rwp0
Copy link
Contributor

rwp0 commented Jun 16, 2024

I believe that's reasonable since method keyword also warns:

> perl -Mfeature=class -E "method {}"

method is experimental at -e line 1.

Cannot 'method' outside of a 'class' at -e line 1.

Searching I couldn't locate where to mark that as experimental, and that's not documented in:

https://github.com/Perl/perl5/blob/blead/pod/perldiag.pod

@jkeenan
Copy link
Contributor

jkeenan commented Jun 18, 2024

@leonerd, can you take a look at this ticket? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants