-
Notifications
You must be signed in to change notification settings - Fork 578
Deprecate smartmatch #20337
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
Deprecate smartmatch #20337
Conversation
The changes to autodie and to the Test-Simple and experimental.pm tests have to be done on CPAN. |
I wonder if it would be best to do those first in a separate |
I don't think we should do this until we have a CPAN module that can largely drop-in replace the core functionality (I don't think it even has to be 100%). I think it's entirely feasible to do this for given/when (I mean, it would largely just be adopting a few chunks code from core). Doing the same for |
I know. I made the changes in the branch to try and get the test suite to pass. The current version of the branch has one test failing, and I don't understand why:
|
The gist of this PR is basically The changes to The actual removal can be done at a later stage (if ever). |
446c551
to
6da1e1d
Compare
An observation and some questions: CI is reporting a porting test failure, which I reproduced locally. I believe it can be fixed with
In blead, I don't see it anywhere.
Where is its "core" implementation? |
I don't think it was discussed very deeply anywhere. We originally tried just using the normal
...
It won't be anywhere currently. |
Yup, I forgot to rerun it after my last modification and rebase. Expect another force push soon.
We discussed this briefly in a PSC meeting. @leonerd said something about having wanted it in the past, but never actually doing it. The It was said on p5p that some were knowingly using smartmatch in a controlled way, knowing its flaws. (I haven't been able to find that email back, so I might have imagined it?) We felt that it would make sense to make it a bit more fine-grained than simply having it covered by the The relevant p5p threads are:
Creating the This has the interesting side effect that the
|
6da1e1d
to
15633a6
Compare
15633a6
to
23aa356
Compare
a288d53
to
041edd3
Compare
You say deprecated, but do you actually mean deprecated or just discouraged? I don't think it's a good idea for |
We actually mean "deprecated". And this clearly says that the next step (at a yet undetermined point in the future) is to remove smartmatch entirely.
I agree with you: Which means my patch against |
041edd3
to
65da878
Compare
I agree; anyone who is using |
65da878
to
49520fd
Compare
I think the next steps are:
|
But that does mean end-users will have to change their code twice to keep it working. That's not very end-user friendly. |
It's more about giving users ample warning that smartmatch is going away. Changing It's a bit more difficult to change code using smartmatch to code not using it; on the other hand, that's a change one can make as soon as they see the deprecation warning. So, best case, they only need to change their code once, to remove smartmatch as soon as we announce it's deprecated. |
This seems to be carving out a special type of deprecation that isn't really deprecation, because we don't plan on actually removing it. If we want to deprecate it, lets just do it normally, without a special category. If we aren't willing to commit to removing it, it should be stabilized. |
autodie 2.35 is on CPAN and I have submitted a sync here. If you have any issues, please let me know and we can sort it! |
I have merged to blead. You should be able to rebase and no longer need to modify autodie |
fd65ec5
to
5b17869
Compare
Make the 'experimental::smartmatch' warning obsolete, and use 'deprecated' instead.
5b17869
to
24edf7e
Compare
I rebased and resolved conflicts on this. |
Thanks. I believe this is ready to be merged, now that the dual-life modules have all been updated. |
regen/feature.pl has been re-run since
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
FWIW, some folks would say we are in the contentious code freeze period. I personally would disagree, and waiting another release cycle would not be helpful. |
On Fri, Feb 24, 2023 at 08:49:39AM -0800, Yves Orton wrote:
Merged #20337 into blead.
cpan/autodie/t/exceptions.t is producing a bunch of warnings. Wasn't this
supposed to be been sorted by pulling in autodie 2.36?
$ ./perl -Ilib cpan/autodie/t/exceptions.t
Smartmatch is deprecated at cpan/autodie/t/exceptions.t line 25.
Smartmatch is deprecated at cpan/autodie/t/exceptions.t line 26.
Smartmatch is deprecated at cpan/autodie/t/exceptions.t line 27.
Smartmatch is deprecated at cpan/autodie/t/exceptions.t line 28.
Smartmatch is deprecated at cpan/autodie/t/exceptions.t line 45.
Smartmatch is deprecated at cpan/autodie/t/exceptions.t line 46.
Smartmatch is deprecated at cpan/autodie/t/exceptions.t line 47.
Smartmatch is deprecated at cpan/autodie/t/exceptions.t line 48.
ok 1 - Exception thrown
...
…--
In England there is a special word which means the last sunshine
of the summer. That word is "spring".
|
|
@iabyn @toddr - I have gotten to the bottom of it, PR coming up. The issue is that @toddr assumed that "deprecated::smartmatch" was a valid warning category. But until my PR is pushed and merged we actually dont support this at all, and dont even have a way to, as we only have a single category "deprecated" and the data structure doesnt support us turning it on AND having a sub category. I have a fix in hand already |
The initial PR added a |
I didn't really assume anything about |
The problem with autodie is not really that it is using the wrong category. The problem is that it uses and tests for smartmatch. It needs more extensive changes. I've begun working on fixing it. |
I've prepared Dual-Life/autodie#117 which adjusts autodie to use the correct warning category, but also to deprecate its own smartmatch handling. |
Ok. So I don't jump the gun, is it ready for release? have we solidified how the perl side will work? |
This is a follow-up from http://nntp.perl.org/group/perl.perl5.porters/264678.
This pull request replaces
experimental::smartmatch
bydeprecated::smartmatch
.The goal is to be more explicit that smartmatch is a failed experiment, and its
use is discouraged.
This also remove some uses of
~~
in the core code.