Skip to content

Commit 505b161

Browse files
bookrjbs
andcommitted
Apply suggestions from code review
Co-authored-by: Ricardo Signes <[email protected]>
1 parent 3b409d3 commit 505b161

File tree

1 file changed

+24
-34
lines changed

1 file changed

+24
-34
lines changed

2024/incoming/perl-version-bumper.pod

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,16 @@ formats, either as a floating-point number, or a v-string):
5353
New versions of Perl come with bug fixes, speed improvements, deprecations
5454
and also new features. It's still the same old Perl, that will continue
5555
to run your existing code. Perl version upgrades are so simple and
56-
drama-less they're almost boring.
56+
drama-less they're almost boring. (The Perl 5 Porters support the two
57+
most recent stable releases of Perl, which should be reason enough to
58+
upgrade your binary.)
5759

5860
Long story short, Perl is extremely backwards compatible. This means that
5961
sensibly-written code from 20 years ago should still run under the
6062
next release of Perl. In other words, any C<perl> interpreter should
6163
understand code written against older versions of the Perl I<language>
6264
just fine. As I have personally experimented, this actually even applies
63-
to scripts targetting the Perl 4 language!
65+
to scripts targetting version 4 of the language!
6466

6567
With such a strong commitment to backwards compatibility, how does
6668
one even introduce new features to the language? To quote from
@@ -101,7 +103,7 @@ Note that enabling features always happens in the current lexical scope.
101103
=head3 The gift of choice
102104

103105
Backwards-compatibility is preserved thanks to a compromise: people have
104-
to I<opt-in> to the new features. The unfortunate side-effect is that
106+
to I<opt in> to the new features. The unfortunate side-effect is that
105107
Perl will continue to look the same (sometimes giving the feeling it's
106108
stagnating) until you enable the new features!
107109

@@ -112,7 +114,7 @@ many were. The L<Syntax::Construct> module has an exhaustive list of
112114
"syntactic constructs that are not implemented via the C<feature> pragma,
113115
but are still not compatible with older versions of Perl".
114116

115-
Perl v5.40 knows about 25 features. While they could be enabled or
117+
Perl v5.40 knows about 25 features. While they can be enabled or
116118
disabled (some features are used to disable undesirable constructs,
117119
like indirect object notation) one by one, there is a better way than
118120
25 lines of boilerplate.
@@ -126,8 +128,8 @@ several operations:
126128

127129
The first thing that C<use VERSION> does is to declare which minimum
128130
version of C<perl> (the interpreter) you expect to run your code. If you
129-
demand a version that is larger than that of the perl binary currently
130-
running your code, it's going to die at compile time.
131+
demand a version later than that of the perl binary currently running
132+
your code, it's going to die at compile time.
131133

132134
$ perl -Mv5.38 -e1
133135
Perl v5.38.0 required--this is only v5.36.0, stopped.
@@ -154,16 +156,16 @@ corresponding feature bundle. For example:
154156

155157
=end perl
156158

157-
is equivalent to:
159+
will implicitly load the corresponding feature bundle:
158160

159161
=begin perl
160162

161163
use feature ':5.10';
162164

163165
=end perl
164166

165-
and will enable the C<say>, C<state> and C<switch> features. The
166-
compiler will now understand the corresponding keywords, and behave
167+
which will enable the C<say>, C<state> and C<switch> features. The
168+
parser will now understand the corresponding keywords, and behave
167169
accordingly. Error messages might differ a lot when a feature is
168170
enabled or not.
169171

@@ -177,7 +179,7 @@ will enable C<strict>, C<use v5.36> will enable C<warnings> and C<use
177179
v5.40> will import L<builtin> functions (using a similar version bundle
178180
scheme: see L<builtin/Version-Bundles>).
179181

180-
Note that this is a lexical pragma, meaning that you could declare
182+
Note that C<use VERSION> is a lexical pragma, meaning that you could declare
181183
different version bundles for different parts of your code. For
182184
consistency, it's really recommended that you pick one version, and
183185
stick with it for the entire file. In fact, a future release of C<perl>
@@ -190,10 +192,11 @@ following two operations in a single line of code:
190192

191193
=head4 Enable modern Perl features
192194

193-
Perl features are generally used to introduce experimental features
194-
without making them part of the "official" language. Features become
195-
official when they are included in a feature bundle. Failed experiments
196-
can be removed safely if they never come out of the experimental phase.
195+
Before features become part of the "official" language, they are often
196+
introduced as experiments. Experimental features are available only when
197+
requested via C<use feature>, and aren't part of a bundle. In fact,
198+
they'll even issue warnings when you use them. (See L<experimental>
199+
for more about this.)
197200

198201
For example, the C<signatures> feature was introduced in C<perl> v5.20,
199202
and remained experimental until v5.34. That meant that, as long as the
@@ -209,13 +212,13 @@ immediately added to the C<:5.38> feature bundle.
209212

210213
=head4 Deprecate discouraged features
211214

212-
Bundles have also been used to deprecate and disable features that have
213-
become discouraged. These are made part of the C<:default> feature bundle,
215+
Bundles have also been used to disable features that have become
216+
discouraged. These are made part of the C<:default> feature bundle,
214217
and not included in later bundles.
215218

216219
Doing it this way makes it possible to preserve the behaviour of
217-
ancient, unmaintained, scripts and modules. Even if they load some
218-
feature bundle (via C<use VERSION>), any deprecated feature they might
220+
ancient, unmaintained scripts and modules. Even if they load some
221+
feature bundle (via C<use VERSION>), any discouraged feature they might
219222
use will also be (retroactively) included in that bundle, preserving
220223
backward compatibitlity.
221224

@@ -225,8 +228,9 @@ C<bareword_filehandles> came to be "removed" from later versions of Perl.
225228
This is the strategy the L<Perl Steering Council|perlgov/The Steering Council>
226229
has chosen to best stretch the language between the continuous
227230
introduction of new features and the preservation of backwards
228-
compatibility. For the record, many Perl 4 (which is actually Perl 3,
229-
from late 1989) scripts still run fine with perl 5.40.
231+
compatibility. For the record, many Perl 4 (which is functionally
232+
identical to Perl 3, from late 1989) scripts still run fine with C<perl>
233+
v5.40.
230234

231235
=head2 Why pick a Perl version?
232236

@@ -277,26 +281,12 @@ It's of course possible to include experimental features, or re-enable
277281
deprecated features (the latter is really not recommended), to fine-tune
278282
the specific dialect of Perl in which the code is written.
279283

280-
Always use a I<stable> version number with C<use VERSION>. The point is to
281-
I<declare> which version of the Perl I<language> your code is targetting.
282-
283284
Future versions of C<perl> implicitly promise that they will understand
284285
the dialect of Perl declared by C<use VERSION>, and that they will run
285286
it to the best of their abilities.
286287

287288
=head2 The Once and Future Perl
288289

289-
Every year, a new version of C<perl> comes out. The C<perl> binary is
290-
updated, and so is the Perl language. The Perl 5 Porters support the
291-
two most recent stable releases of Perl, which gives you a good reason
292-
to upgrade your binary. You don't have to upgrade the version of the
293-
language your code uses, though.
294-
295-
If you use Perl in 2024, you don't have to write code like the dot-com
296-
bubble is about to burst. (Be wary of the AI bubble, though...)
297-
You can easily signal your code was written in the last decade,
298-
and enjoy the recent evolutions of the language.
299-
300290
=head3 The new "use strict and warnings"
301291

302292
Since the time of "use strict and warnings" as minimum requirements for

0 commit comments

Comments
 (0)