My Favorite Warnings: experimental
Perl has had experimental features ever since I started using it at about version 5.6. These were things that were considered useful, but about which there was doubt -- about their final form, whether a satisfactory implementation existed, or whatever.
Until Perl 5.18, experimental features were simply documented as experimental. At that point, an experimental
warning category was added, with sub-categories experimental::lexical_subs
, experimental::lexical_topic
, experimental::regex_sets
, and experimental::smartmatch
.
Most of the features covered by the original Perl 5.18 warning categories were actually introduced in Perl 5.10 as back-ports from Raku (or Perl 6, as it was then called), and not documented as experimental. My impression was that the relevant experimental::
warnings were introduced becaue the corresponding features were recognized as being more experimental than originally believed. Programmers already familiar with a feature might not notice an extra sentence in the documentation, but they will surely notice if their code starts spitting out experimental
warnings.
Since that time a number of experimental warnings have been introduced, the latest in production being experimental::isa introduced in Perl 5.32 and experimental::try introduced in Perl 5.34. As of Perl 5.34, 19 experimental categories are defined, including experimental
itself.
In theory, experimental features are eventually judged successful and considered mainstream Perl 5, or judged unsuccessful and removed.
If an experiment is successful, the warnings are removed, but for backward compatibility the warning category remains, even though it no longer corresponds to any diagnostics. These are included in the 19 categories reported a couple paragraphs ago.
If an experiment fails, both its implementation and its warning category are removed, so that any use of it (including an attempt to explicitly enable or disable its warnings) will result in a fatal error. As of Perl 5.34.0 there are only two of these, experimental::autoderef
and experimental::lexical_topic
, both of which were discussed in My Favorite (?) Warnings - Ex-Warnings.
Previous entries in this series:
thanks for interesting historical detail, I did not hear this before.