given/when are deprecated and will be removed in a future release.
References are a PITA - cumbersome to use, and they make code less readable.
Perl doesn't have first class functions (you can pass or return functions via references, but that's cumbersome and less readable compared to languages with better FP support).
>>given/when are deprecated and will be removed in a future release.
given/when won't be removed, too much back wards compatibility issues.
>>References are a PITA - cumbersome to use, and they make code less readable.
Depends what you mean readable though. In python you can't tell whats a variable and whats a list, and whats a dictionary by looking. One can claim whole language is unreadable since variables are needed at every step.
>>but that's cumbersome and less readable compared to languages with better FP support
Sure let them add all the other practical goodness of Perl, then we can use them.
% perl -v | head -2
This is perl 5, version 40, subversion 0 (v5.40.0) built for x86_64-linux
%
% perl -E 'use feature "switch"; my ($x, $y); given ($x) { $y = 1 when /^abc/ }'
given is deprecated at -e line 1.
when is deprecated at -e line 1.
This is also mentioned in the docs:
Smartmatch is now seen as a failed experiment and was marked as deprecated in Perl 5.37.10.
This includes the when and given keywords, as well as the smartmatch operator ~~.
The feature will be removed entirely in the Perl 5.42.0 production release.
References are a PITA - cumbersome to use, and they make code less readable.
Perl doesn't have first class functions (you can pass or return functions via references, but that's cumbersome and less readable compared to languages with better FP support).