-
Notifications
You must be signed in to change notification settings - Fork 559
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
Feature guard the removal of smartmatch #22752
Comments
There's no need for a new feature name - given/when/smartmatch was always historically guarded by the "switch" feature, changing this would break code that specifically enables (or disables, which I've done) the switch feature. You're also suggesting adding this feature to the default bundle, even though it wasn't included in the default bundle previously. It was included in all other bundles (5.10 onwards). So as far as I can see what needs to be done is:
|
Actually, switch was removed from versioned bundles starting from v5.35, so it doesn't need to be removed from later bundles. |
Unfortunately, the 'switch' feature only dictates the availability of the given/when keywords, not the smartmatch operator. So in my opinion, it's appropriate to add a corrolary 'smartmatch' feature and remove it from the bundle in the same way; and the 'switch' feature should require the 'smartmatch' feature as necessary for its implementation, and conversely disabling 'smartmatch' must disable 'switch'. |
Yes, the point of I think the two features are actually orthogonal: it's possible to use
|
Thanks, I never used smartmatch beyond test code /me removes boot from mouth. I'll add the smartmatch feature as mentioned. The feature dependency is something new and I'm not sure how it should behave:
something else? |
It is possible to use given/when without ~~, but it is implicitly used depending on the expression being matched, so I'm not sure what should happen if 'switch' is enabled but 'smartmatch' is not in those cases. I suggest doing whatever is simplest since both of these features will be deprecated/not available in modern code. |
I think it's best to keep them independent. If one does |
Concur. |
That would complicate things, because when really does a |
If it does a smartmatch under the hood, that's fine. The feature should only control the |
ae78ae4 merged the removal of smartmatch, which was planned for Perl v5.42.
After more discussion, the PSC believes it would be better to make the removal guarded by a feature.
(Similar to what was done with the
indirect
,multidimensional
,bareword_filehandles
andapostrophe_as_package_separator
features.)That feature would be included in the
:default
feature bundle and all bundles up to:5.40
. It wouldn't be included in:5.42
. The main benefit would be that none of the unmaintained modules on CPAN and elsewhere would break, while newer code (declaring the Perl version it codes against withuse VERSION
) would not be able to use smartmatch any more.The proposed name for the feature is simply
smartmatch
.Note: This goes against the idea proposed by @iabyn of creating an "air gap" of multiple versions without a smartmatch, that could allow to re-introduce a better smartmatch in the future. It is still possible to take this approach in an undetermined future.
The text was updated successfully, but these errors were encountered: