Skip to content

Commit 9d3ffd5

Browse files
committed
perlapi/perlintern: Note binary-compatibility-only entries
Some API elements exist only so that already-existing uses of them can continue to use them without change. Generally newer/shinier methods have come along to accomplish the tasks these do, and new code should use those newer methods. It effectively is deprecated to use these for new code. This commit changes perlapi and perlintern to highlight such elements as not being wise to use going forward. Also, we should feel no pressure to add documention on how to use these elements. The code that already uses them probably already knows how to use them. And if it isn't using them properly, it would be advantageous to convert to use the shinier method, instead of trying to figure out how to get the old one to work. However, this change shows that some elements are wrongly marked as being binary-compatibility only. The list of these needs to examined, and other commits made to remove that marking when appropriate. The list is contained in http://nntp.perl.org/group/perl.perl5.porters/269936
1 parent 79d4169 commit 9d3ffd5

File tree

1 file changed

+39
-8
lines changed

1 file changed

+39
-8
lines changed

autodoc.pl

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@
7777
qr/[aA bC dD eE fF Gh iI mM nN oO pP rR sS T uU vW xX y;#?]/xx;
7878

7979
# Flags that don't apply to this program, like implementation details.
80-
my $irrelevant_flags_re = qr/[ab eE G iI P rR vX?]/xx;
80+
my $irrelevant_flags_re = qr/[a eE G iI P rR vX?]/xx;
8181

8282
# Only certain flags dealing with what gets displayed, are acceptable for
8383
# apidoc_item
84-
my $item_flags_re = qr/[dD fF mM nN oO pT uU Wx;]/xx;
84+
my $item_flags_re = qr/[ b dD fF mM nN oO pT uU Wx; ]/xx;
8585

8686
use constant {
8787
NOT_APIDOC => -1,
@@ -1625,6 +1625,7 @@ ($fh, $section_name, $element_name, $docref)
16251625
print $fh "\n=item C<${$_}->{name}>\n" for @items;
16261626

16271627
my @where_froms;
1628+
my @bin_compat;
16281629
my @deprecated;
16291630
my @experimental;
16301631
my @xrefs;
@@ -1642,8 +1643,15 @@ ($fh, $section_name, $element_name, $docref)
16421643
# entry, so no X<> here.
16431644
push @xrefs, $name unless $item->{flags} =~ /h/;
16441645

1645-
push @deprecated, "C<$name>" if $item->{flags} =~ /D/;
1646-
push @experimental, "C<$name>" if $item->{flags} =~ /x/;
1646+
if ($item->{flags} =~ /D/) {
1647+
push @deprecated, "C<$name>";
1648+
}
1649+
elsif ($item->{flags} =~ /b/) {
1650+
push @bin_compat, "C<$name>";
1651+
}
1652+
elsif ($item->{flags} =~ /x/) {
1653+
push @experimental, "C<$name>";
1654+
}
16471655
}
16481656

16491657
# While we're going though the items, construct a nice list of where
@@ -1695,7 +1703,7 @@ ($fh, $section_name, $element_name, $docref)
16951703
print $fh format_pod_indexes(\@xrefs);
16961704
print $fh "\n" if @xrefs;
16971705

1698-
for my $which (\@deprecated, \@experimental) {
1706+
for my $which (\@deprecated, \@experimental, \@bin_compat) {
16991707
next unless $which->@*;
17001708

17011709
my $is;
@@ -1731,6 +1739,13 @@ ($fh, $section_name, $element_name, $docref)
17311739
new code; remove $it from existing code.
17321740
EOT
17331741
}
1742+
elsif ($which == \@bin_compat) {
1743+
print $fh <<~"EOT";
1744+
1745+
C<B<DO NOT USE FOR NEW CODE!>> $list $is retained only so
1746+
that existing applications that use $it don't have to change.
1747+
EOT
1748+
}
17341749
else {
17351750
print $fh <<~"EOT";
17361751
@@ -2696,7 +2711,7 @@ ($destpod)
26962711
# documentation is missing
26972712

26982713
for my $which (\%api, \%intern) {
2699-
my (@deprecated, @experimental, @missings);
2714+
my (@deprecated, @experimental, @missings, @bin_compat);
27002715
for my $name (sort dictionary_order keys %elements) {
27012716
my $element = $elements{$name};
27022717

@@ -2724,6 +2739,9 @@ ($destpod)
27242739
elsif ($element->{flags} =~ /x/) {
27252740
push @experimental, $name;
27262741
}
2742+
elsif ($element->{flags} =~ /b/) {
2743+
push @bin_compat, $name;
2744+
}
27272745
else {
27282746
push @missings, $name;
27292747
}
@@ -2734,6 +2752,7 @@ ($destpod)
27342752
$which->{missings}->@* = (
27352753
missings_hdr => \@missings,
27362754
experimental_hdr => \@experimental,
2755+
bin_compat_hdr => \@bin_compat,
27372756
deprecated_hdr => \@deprecated,
27382757
);
27392758
}
@@ -2897,6 +2916,12 @@ ($destpod)
28972916
|usable by you.
28982917
_EOT_
28992918

2919+
$api{bin_compat_hdr} = <<"_EOT_";
2920+
|
2921+
|Next are the API-flagged elements that are retained only so that code that
2922+
|already uses them doesn't have to change. DO NOT ADD ANY NEW USES FOR THESE.
2923+
_EOT_
2924+
29002925
$api{experimental_hdr} = <<"_EOT_";
29012926
|
29022927
|Next are the API-flagged elements that are considered experimental. Using one
@@ -2949,9 +2974,15 @@ ($destpod)
29492974
|This section lists the elements that are otherwise undocumented. If you use
29502975
|any of them, please consider creating and submitting documentation for it.
29512976
|
2952-
|Experimental and deprecated undocumented elements are listed separately at the
2953-
|end.
2977+
|Elements that are problematic to use (such as being experimental) are listed
2978+
|separately at the end.
2979+
|
2980+
_EOT_
2981+
2982+
$intern{bin_compat_hdr} = <<"_EOT_";
29542983
|
2984+
|Next are the elements that are retained only so that code that already uses
2985+
|them doesn't have to change. DO NOT ADD ANY NEW USES FOR THESE.
29552986
_EOT_
29562987

29572988
$intern{experimental_hdr} = <<"_EOT_";

0 commit comments

Comments
 (0)