perl: indicate features distinct from experimental
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 3 Mar 2017 16:18:18 +0000 (17:18 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 22 Mar 2017 21:28:04 +0000 (22:28 +0100)
Describe attributes as hash after all, especially with this additional
parameter.

perl.inc.pl
perl.plp

index 09fff96479fffd094d29362fcc368fe38b35c784..ee6d9a225bf205e05077c0f58927f77b500bcb0b 100644 (file)
@@ -4,15 +4,15 @@ use utf8;
        v5.6 => {
                new => [
                        ['<code>use warnings</code>', 'pragma to enable warnings in lexical scope'],
-                       ['<code>use utf8</code>', 'experimental unicode semantics <small>(completed in v5.8)</small>', v5.8],
+                       ['<code>use utf8</code>', 'experimental unicode semantics <small>(completed in v5.8)</small>', {experimental => 0, stable => v5.8}],
                        ['<code>use charnames</code>', 'string escape <code>\N{}</code> to insert named character'],
                        ['<code>our</code>', 'declare global variables'],
                        ['<code>v1.2.3</code>', q"represent strings as vector of ordinals, useful in version numbers (<code>printf '%vd'</code> to display)"],
                        ['<code>0b0</code>', q"binary numbers in literals, <code>printf '%b'</code>, and <code>oct</code>"],
-                       ['<code>sub :lvalue</code>', 'subroutine attribute to return a modifiable value', v5.20],
+                       ['<code>sub :lvalue</code>', 'subroutine attribute to return a modifiable value', {experimental => 0, stable => v5.20}],
 #                      ['<code>sub :locked :method</code>', 'syntax to declare subroutine attributes'], # can be inferred from :lvalue support
                        ['<code>open my $fh, $mode, $expr</code>', 'file handles in scoped scalars, third argument for unambiguous file name'],
-                       [q"<code>pack 'q'</code>", '64-bit integer support (also large files &gt;2GiB)', v5.8.1],
+                       [q"<code>pack 'q'</code>", '64-bit integer support (also large files &gt;2GiB)', {experimental => 0, stable => v5.8.1}],
                        ['<code>sort $coderef ()</code>', 'comparison function can be a subroutine reference; prototype <code>($$)</code> to pass elements as normal <code>@_</code>'],
                        ['<code>CHECK {}</code>', 'special block called at end of compilation'],
                        ['<code>/[[:…:]]/</code>', 'POSIX character class syntax such as <code>/[[:alpha:]]/</code>'],
@@ -53,16 +53,16 @@ use utf8;
        v5.10 => {
                new => [
                        ['<code>//</code>', 'defined-or operator'],
-                       ['<code>~~</code>', 'smart-match operator to compare different data types <small>(updated in v5.10.1)</small>', 'experimental::smartmatch'],
-                       ['<code>say</code>', 'print with newline, equivalent to <code>print @_, "\n"</code>'],
-                       ['<code>given</code>', 'switch statement to smart-match with <code>when</code>/<code>default</code>', 'experimental::smartmatch'],
+                       ['<code>~~</code>', 'smart-match operator to compare different data types <small>(updated in v5.10.1)</small>', {experimental => 'smartmatch'}],
+                       ['<code>say</code>', 'print with newline, equivalent to <code>print @_, "\n"</code>', {feature => 'say'}],
+                       ['<code>given</code>', 'switch statement to smart-match with <code>when</code>/<code>default</code>', {feature => 'switch', experimental => 'smartmatch'}],
                        ['<code>/(?&lt;name>)/</code>', 'named capture buffers into <code>%+</code>'],
                        ['<code>/(?1)/</code>', 'recursive regular expression patterns'],
                        ['<code>/.++/</code>', 'possessive quantifiers <code>?+</code>, <code>*+</code>, <code>++</code> to match greedily'],
                        ['<code>s/keep\K//</code>', 'floating positive lookbehind, efficient alternative for <code>s/(keep)/$1/</code>'],
                        ['<code>/\v/, /\h/</code>', 'vertical and horizontal whitespace escapes'],
-                       ['<code>my $_</code>', 'lexically scoped version of the default variable', v0.5.23.4, 'experimental::lexical_topic'],
-                       ['<code>state</code>', 'persistent <code>my</code> variables'],
+                       ['<code>my $_</code>', 'lexically scoped version of the default variable', {experimental => 'lexical_topic', dropped => v5.23.4}],
+                       ['<code>state</code>', 'persistent <code>my</code> variables', {feature => 'state'}],
                ],
                release => '2007-12-18',
                distro => {
@@ -82,7 +82,7 @@ use utf8;
                        ['<code>use 5.012</code>', 'implicit <code>strict</code> if use VERSION >= v5.12'],
                        ['<code>… when</code>', '<code>when</code> is now allowed to be used as a statement modifier'],
                        [q"<code>use overload 'qr'</code>", 'customisable conversion to regular expressions'],
-                       ['<code>/\N/</code>', 'inverse \n to match any character except newline regardless of <code>/s</code>', v5.18],
+                       ['<code>/\N/</code>', 'inverse \n to match any character except newline regardless of <code>/s</code>', {experimental => 0, stable => v5.18}],
                ],
                release => '2010-04-12',
                unicode => '5.2',
@@ -96,9 +96,9 @@ use utf8;
                new => [
                        ['<code>s///r</code>', 'non-destructive substitution'],
                        ['<code>/(?^)/</code>', 'construct to reset to default modifiers'],
-                       ['<code>/(?{ m() })/</code>', 'regular expressions can be nested in <code>/(?{})/</code> and <code>/(??{})/</code>', v5.20],
+                       ['<code>/(?{ m() })/</code>', 'regular expressions can be nested in <code>/(?{})/</code> and <code>/(??{})/</code>', {experimental => 0, stable => v5.20}],
                        [q"<code>use re '/flags'</code>", 'customise default modifiers'],
-                       ['<code>each $ref</code> e.a.', 'array and hash container functions accept references', v0.5.23.1],
+                       ['<code>each $ref</code> e.a.', 'array and hash container functions accept references', {experimental => 'postderef', dropped => v5.23.1}],
                        ['<code>FH->method</code>', 'filehandle method calls load IO::File on demand (eg. <code>STDOUT->flush</code>)'],
                ],
                release => '2011-05-14',
@@ -111,8 +111,8 @@ use utf8;
 
        v5.16 => {
                new => [
-                       ['<code>__SUB__</code>', 'current subroutine reference'],
-                       ['<code>fc, "\F"</code>', 'unicode foldcase to compare case-insensitively'],
+                       ['<code>__SUB__</code>', 'current subroutine reference', {feature => 'current_sub'}],
+                       ['<code>fc, "\F"</code>', 'unicode foldcase to compare case-insensitively', {feature => 'fc'}],
                        ['<code>"\N{}"</code>', 'automatic <code>use charnames qw( :full :short )</code>'],
                ],
                release => '2012-05-20',
@@ -126,10 +126,10 @@ use utf8;
        v5.18 => {
                new => [
                        ['<code>${^LAST_FH}</code>', 'last read filehandle (used by <code>$.</code>)'],
-                       ['<code>/(?[ a + b ])/</code>', 'regex set operations (character substraction <code>-</code>, unions <code>&amp;</code>)', 'experimental::regex_sets'],
-                       ['<code>my sub</code>', 'lexical subroutines (also <code>state</code>, <code>our</code>); buggy before v5.22', 'experimental::lexical_subs'],
+                       ['<code>/(?[ a + b ])/</code>', 'regex set operations (character substraction <code>-</code>, unions <code>&amp;</code>)', {experimental => 'regex_sets'}],
+                       ['<code>my sub</code>', 'lexical subroutines (also <code>state</code>, <code>our</code>); buggy before v5.22', {feature => 'lexical_subs', experimental => 'lexical_subs'}],
                        ['<code>next $expression</code>', 'loop controls allow runtime expressions'],
-                       [q"<code>no warnings 'experimental::…'</code>", 'mechanism for experimental features, as of now required for smartmatch'],
+                       [q"<code>no warnings 'experimental::…'</code>", 'mechanism for experimental features, as of now required for <em>smartmatch</em>'],
                ],
                release => '2013-05-18',
                distro => {
@@ -140,9 +140,9 @@ use utf8;
 
        v5.20 => {
                new => [
-                       ['<code>sub ($var)</code>', 'subroutine signatures', 'experimental::signatures'],
+                       ['<code>sub ($var)</code>', 'subroutine signatures', {feature => 'signatures', experimental => 'signatures'}],
                        ['<code>%hash{…}</code>', 'hash slices return key+value pairs'],
-                       ['<code>[]->@*</code>', 'postfix dereferencing (also e.g. <code>$scalar->$*</code> for <code>$$scalar</code>)', v5.23.1, 'experimental::postderef'],
+                       ['<code>[]->@*</code>', 'postfix dereferencing (also e.g. <code>$scalar->$*</code> for <code>$$scalar</code>)', {feature => 'postderef, postderef_qq', experimental => 'postderef', stable => v5.23.1}],
                        [q"<code>use warnings 'once'; $a</code>", 'variables $a and $b are exempt from <em>used once</em> warnings'],
                ],
                unicode => '6.3',
@@ -156,12 +156,12 @@ use utf8;
 
        v5.22 => {
                new => [
-                       ['<code>\$alias =</code>', 'aliasing via reference (scoped as of v5.25.3)', 'experimental::refaliasing'],
+                       ['<code>\$alias =</code>', 'aliasing via reference (scoped as of v5.25.3)', {experimental => 'refaliasing'}],
                        ['<code>&lt;&lt;>></code>', 'safe <code>readline</code> ignoring open flags in arguments'],
                        ['<code>/()/n</code>', 'flag to disable numbered capturing, turning <code>()</code> into <code>(?:)</code>'],
                        ['<code>/\b{}/</code>', 'boundary types: <em>gcb</em> (grapheme cluster), <em>sb</em> (sentence), <em>wb</em> (word)'],
-                       ['<code>&.</code>', '<code>& | ^ ~</code> consistently numeric, dotted operators for strings', 'experimental::bitwise'],
-                       [q"<code>use re 'strict'</code>", 'apply stricter syntax rules to regular expression patterns', 'experimental::re_strict'],
+                       ['<code>&.</code>', '<code>& | ^ ~</code> consistently numeric, dotted operators for strings', {experimental => 'bitwise'}],
+                       [q"<code>use re 'strict'</code>", 'apply stricter syntax rules to regular expression patterns', {experimental => 're_strict'}],
                        ['<code>0x.beep+0</code>', q"hexadecimal floating point notation with binary power; <code>printf '%a'</code> to display"],
                ],
                unicode => '7.0',
index 0a13fdc95115081778fb6b5f12f68ba5371499e0..ff3054e679b8575e87d8ecaebaf1fc560cceae89 100644 (file)
--- a/perl.plp
+++ b/perl.plp
@@ -29,24 +29,30 @@ for my $vernum (reverse sort keys %{$info}) {
        print '<div class="section">'."\n";
        printf '<h2>%vd <small>%s</small></h2><dl>'."\n", $vernum, $verrow->{release};
        for (@{ $verrow->{new} }) {
-               if (defined (my $experimental = $_->[2])) {
-                       my $title = 'experimental';
-                       my $class = ' class="ex"';
-                       if (ref \$experimental eq 'VSTRING') {
-                               my $dropped = $experimental =~ s/^\0//
-                                       and (exists $get{v} or next);
-                               $title = sprintf('%s %vd',
-                                       $dropped ? 'removed in ' : "$title until",
-                                       $experimental,
-                               );
-                               $experimental = $_->[3];  # optional additional class
+               my ($topic, $desc, $attr) = @{$_};
+               if ($attr) {
+                       my $title;
+                       if (defined $attr->{experimental}) {
+                               $title = 'experimental';
                        }
-                       if ($experimental) {
-                               $class .= sprintf ' title="%s"', $experimental;
+                       if ($attr->{dropped}) {
+                               next unless exists $get{v};
+                               $title = sprintf 'removed in %vd', $attr->{dropped};
                        }
-                       $_->[1] .= qq{ <em$class>($title)</em>};
+                       elsif ($attr->{stable}) {
+                               $title .= sprintf ' until %vd', $attr->{stable};
+                       }
+                       if ($attr->{experimental}) {
+                               $title = sprintf '<span title="experimental::%s">%s</span>',
+                                       $attr->{experimental}, $title;
+                       }
+                       if ($attr->{feature}) {
+                               $title = sprintf('<span title="%s">feature</span>', $attr->{feature})
+                                       . (defined $title && ", $title");
+                       }
+                       $desc .= sprintf ' <em class="ex">(%s)</em>', $title;
                }
-               printf '<dt>%s<dd>%s'."\n", @{$_}, '<br/>'
+               printf '<dt>%s<dd>%s'."\n", $topic, $desc || '<br/>';
        }
        printf '<dt>Unicode</dt><dd>v%s'."\n", $_ for $verrow->{unicode} || ();
        print "</dl>\n";