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

[EXPERIMENT] infix "isa" operator #18754

Closed
rjbs opened this issue Apr 30, 2021 · 11 comments
Closed

[EXPERIMENT] infix "isa" operator #18754

rjbs opened this issue Apr 30, 2021 · 11 comments
Labels
experiment ticket tracking an active experiment

Comments

@rjbs
Copy link
Member

rjbs commented Apr 30, 2021

Issue #17200 describes the plan for an infix "isa" operator, which was added to the language in v5.32.0 as an experiment. This issue tracks the experiment toward its conclusion.

@rjbs rjbs added the experiment ticket tracking an active experiment label Apr 30, 2021
@oodler577
Copy link

The utility of this not withstanding, As an outside observer, I have a concern that the way in which it is implemented invites a whole host of additions. trim was implemented the same way. So I am not sure if this comment is even approprite here, but wanted to get it out there. The great @leonerd even wrote a very easy to follow recipe for this. On one hand, it's great to provide such an illustration; on the other hand, I don't think y'all want me clogging up the works with "experiments" through this avenue. So I guess I can rephrase as a question, is isa implemented in "right" way for current and future feature experiments? This could also be a good thing. And I do not know, which is simply the reason I am asking.

@leonerd
Copy link
Contributor

leonerd commented May 1, 2021

Context on isa: It's experimental due to standard "it's new" policy, but I don't have any particular plans to alter it in the future. I suspect it would still be useful to add a does operator for doing the ->DOES role-type query, but that might be a separate issue.

As it stands I believe isa can be de-experimentalized after a suitable time - as yet to be decided.

@leonerd
Copy link
Contributor

leonerd commented Jun 1, 2021

Aside from a tiny correction in documentation, this feature remained unchanged through the entire 5.33 series, and is the same in 5.34.0 as when it was released in 5.32.0. If there are no significant changes by the time we release 5.36.0, I see no reason it needs to remain experimental.

I have no plans to make any further changes to it, so I suspect if the situation remains as it is, we should unmark it around the time of 5.35.6 or so - by my count that would be around January 2022.

@leonerd
Copy link
Contributor

leonerd commented Feb 8, 2022

A (currently-draft) PR to deêxperimentalise isa here: #19400

leonerd added a commit to leonerd/perl5 that referenced this issue Feb 14, 2022
leonerd added a commit to leonerd/perl5 that referenced this issue Feb 15, 2022
leonerd added a commit to leonerd/perl5 that referenced this issue Feb 15, 2022
leonerd added a commit to leonerd/perl5 that referenced this issue Feb 15, 2022
@robrwo
Copy link
Contributor

robrwo commented Apr 25, 2022

I am getting errors in Perl v5.34 with DateTime classes:

if ($date isa DateTime) { ... }

The error is

Can't locate object method "isa" via package "DateTime"

I'm having trouble reproducing this in a simple test script, but this error is preventing me from using the feature in one codebase.

FWIW, it's with DateTime 1.57.

@leonerd
Copy link
Contributor

leonerd commented Apr 25, 2022

@robrwo Don't forget you still need to use feature "isa" to enable the parser to recognise the new operator.

$ perl -cE 'say "OK" if [] isa "ARRAY"'
Bareword found where operator expected at -e line 1, near "] isa"
        (Missing operator before isa?)
String found where operator expected at -e line 1, near "isa "ARRAY""
        (Do you need to predeclare isa?)
syntax error at -e line 1, near "] isa "
-e had compilation errors.

$ perl -cE 'use feature "isa"; say "OK" if [] isa "ARRAY"'
isa is experimental at -e line 1.
-e syntax OK

@robrwo
Copy link
Contributor

robrwo commented Apr 25, 2022

@leonerd No, even using the experimental and/or feature pragmas, I still get this error.

@robrwo
Copy link
Contributor

robrwo commented Apr 25, 2022

I also get the error when saying

no feature 'indirect';

@leonerd
Copy link
Contributor

leonerd commented Apr 25, 2022

Interesting. I'd suggest raising it as a new bug with source, instead of here on this experiment-tracking issue.

@haarg
Copy link
Contributor

haarg commented Apr 25, 2022

That error sounds a lot like #18679, but that is fixed in 5.34.0.

@robrwo
Copy link
Contributor

robrwo commented Jun 10, 2022

That error sounds a lot like #18679, but that is fixed in 5.34.0.

I get the error in 5.34.0. I am trying to write a simple script to replicate it.

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

No branches or pull requests

5 participants