G'day Darkwing,
"Now this page Beware of the removal of when in Perl v5.28 tells that when() will be removed in perl 5.28, ..."
Well, it doesn't actually say it will be removed, rather to beware of its removal.
Yes, I know, it's a subtle distinction.
If you look at the abstract, you'll see
"... I haven’t seen an official notice ...", followed by
"... by popular outcry these changes won’t be in v5.28.".
Also note that the article is about six months old.
Perl 5.28 is currently at RC4 (RC=Release Candidate), and when is still there.
I would, however, draw your attention to
"perlsyn: Experimental Details on given and when" (from 5.28-RC4).
Note phrases like "highly experimental" and "subject to change with little notice"
whilst reading that section.
At the end of the day, you shouldn't be using any experimental features in production code.
Of course, this particular feature is a little tricky in that regard.
It was introduced in 5.10 and many, myself included, used it.
But, in 5.18 it was made experimental:
"perl5180delta: The smartmatch family of features are now experimental".
I'd advise not using it in any commercial or production grade code; and being aware of potential problems when using it elsewhere.
| [reply] [d/l] |
Will 'when()' be removed or deprecated in upcoming version of Perl?
Looking at the latest v5.28.0-RC4's perldelta, perldeprecation, and perlexperiment, the answer is no, smart matching and given/when are not going to change in v5.28.
However, they are still experimental, and so it's still very much possible they may undergo major changes or be removed in a future version. I would strongly recommend avoiding them. The simplest replacement (although not necessarily the prettiest) is if/elsif chains, but there are also several modules on CPAN - just beware of Switch and other modules that make use of source filters.
| [reply] [d/l] |
The two replies by haukex, and kcott, are very good, and pretty well cover it.
I would only add that; if you find you're really hooked on when, and it get's nuked. You could always make it a sub, or export it from an earlier Perl release, and turn it into a CPAN module. :-)
--Chris
Evil is good, for without it, Good would have no value
¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH
| [reply] |