Change 20515 by [EMAIL PROTECTED] on 2003/08/06 10:44:50

        v-strings saga continues.
        - use/require 1.2.3 is okay, do not warn
        - however, v1.2.3 is warnable offense
        - as is e.g. '$a = 1.2.3'
        - remove the 'v-strings in use/require non-portable' warning
        
        Next I need to bring back the recently removed or reworked
        v-strings documentation and rework all that to talk of
        'version objects'.

Affected files ...

... //depot/maint-5.8/perl/embedvar.h#30 edit
... //depot/maint-5.8/perl/intrpvar.h#24 edit
... //depot/maint-5.8/perl/perlapi.h#27 edit
... //depot/maint-5.8/perl/pod/perldiag.pod#33 edit
... //depot/maint-5.8/perl/pp_ctl.c#33 edit
... //depot/maint-5.8/perl/t/lib/warnings/toke#5 edit
... //depot/maint-5.8/perl/toke.c#31 edit

Differences ...

==== //depot/maint-5.8/perl/embedvar.h#30 (text+w) ====
Index: perl/embedvar.h
--- perl/embedvar.h#29~20271~   Mon Jul 28 08:18:57 2003
+++ perl/embedvar.h     Wed Aug  6 03:44:50 2003
@@ -276,6 +276,7 @@
 #define PL_glob_index          (PERL_GET_INTERP->Iglob_index)
 #define PL_globalstash         (PERL_GET_INTERP->Iglobalstash)
 #define PL_hash_seed           (PERL_GET_INTERP->Ihash_seed)
+#define PL_hash_seed_set       (PERL_GET_INTERP->Ihash_seed_set)
 #define PL_he_arenaroot                (PERL_GET_INTERP->Ihe_arenaroot)
 #define PL_he_root             (PERL_GET_INTERP->Ihe_root)
 #define PL_hintgv              (PERL_GET_INTERP->Ihintgv)
@@ -285,6 +286,7 @@
 #define PL_in_load_module      (PERL_GET_INTERP->Iin_load_module)
 #define PL_in_my               (PERL_GET_INTERP->Iin_my)
 #define PL_in_my_stash         (PERL_GET_INTERP->Iin_my_stash)
+#define PL_in_require          (PERL_GET_INTERP->Iin_require)
 #define PL_incgv               (PERL_GET_INTERP->Iincgv)
 #define PL_initav              (PERL_GET_INTERP->Iinitav)
 #define PL_inplace             (PERL_GET_INTERP->Iinplace)
@@ -603,6 +605,7 @@
 #define PL_in_load_module      (vTHX->Iin_load_module)
 #define PL_in_my               (vTHX->Iin_my)
 #define PL_in_my_stash         (vTHX->Iin_my_stash)
+#define PL_in_require          (vTHX->Iin_require)
 #define PL_incgv               (vTHX->Iincgv)
 #define PL_initav              (vTHX->Iinitav)
 #define PL_inplace             (vTHX->Iinplace)
@@ -924,6 +927,7 @@
 #define PL_Iin_load_module     PL_in_load_module
 #define PL_Iin_my              PL_in_my
 #define PL_Iin_my_stash                PL_in_my_stash
+#define PL_Iin_require         PL_in_require
 #define PL_Iincgv              PL_incgv
 #define PL_Iinitav             PL_initav
 #define PL_Iinplace            PL_inplace

==== //depot/maint-5.8/perl/intrpvar.h#24 (text) ====
Index: perl/intrpvar.h
--- perl/intrpvar.h#23~20271~   Mon Jul 28 08:18:57 2003
+++ perl/intrpvar.h     Wed Aug  6 03:44:50 2003
@@ -560,6 +560,8 @@
 
 PERLVARI(Ihash_seed_set, bool, FALSE)          /* Hash initialized? */
 
+PERLVAR(Iin_require,           I32)            /* we're compiling a "require" (or 
"use") declaration */
+
 /* New variables must be added to the very end, before this comment,
  * for binary compatibility (the offsets of the old members must not change).
  * (Don't forget to add your variable also to perl_clone()!)

==== //depot/maint-5.8/perl/perlapi.h#27 (text+w) ====
Index: perl/perlapi.h
--- perl/perlapi.h#26~20271~    Mon Jul 28 08:18:57 2003
+++ perl/perlapi.h      Wed Aug  6 03:44:50 2003
@@ -296,6 +296,8 @@
 #define PL_in_my               (*Perl_Iin_my_ptr(aTHX))
 #undef  PL_in_my_stash
 #define PL_in_my_stash         (*Perl_Iin_my_stash_ptr(aTHX))
+#undef  PL_in_require
+#define PL_in_require          (*Perl_Iin_require_ptr(aTHX))
 #undef  PL_incgv
 #define PL_incgv               (*Perl_Iincgv_ptr(aTHX))
 #undef  PL_initav

==== //depot/maint-5.8/perl/pod/perldiag.pod#33 (text) ====
Index: perl/pod/perldiag.pod
--- perl/pod/perldiag.pod#32~20472~     Mon Aug  4 00:01:58 2003
+++ perl/pod/perldiag.pod       Wed Aug  6 03:44:50 2003
@@ -4419,17 +4419,16 @@
 its equivalent C<BEGIN> block found an internal inconsistency with
 the version number.
 
-=item v-string in use/require is non-portable
+=item Version objects are deprecated outside of use/require
 
-(W portable) The use of v-strings is non-portable to older, pre-5.6, Perls.
-If you want your scripts to be backward portable, use the floating
-point version number: for example, instead of C<use 5.6.1> say
-C<use 5.006_001>.  This of course won't help: the older Perls
-won't suddenly start understanding newer features, but at least
-they will show a sensible error message indicating the required
-minimum version.
+(D deprecated) What used to be "version strings" or v-strings is
+deprecated.  What looks like those (but always without the leading
+'v') can still be used, but only when using C<use> or C<require>,
+and these are called "Version Objects".  See L<perldata/"Version
+Strings">, L<perlfunc/use>, and L<perlfunc/require> for more
+information.
 
-=item v-strings are deprecated
+=item v-strings are deprecated (especially those beginning with 'v')
 
 (D deprecated) v-strings are deprecated.  Their semantics and use were
 found to be overly confusing and error-prone.

==== //depot/maint-5.8/perl/pp_ctl.c#33 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#32~20181~     Wed Jul 23 06:12:38 2003
+++ perl/pp_ctl.c       Wed Aug  6 03:44:50 2003
@@ -2980,9 +2980,6 @@
                    "v%d.%d.%d, stopped", rev, ver, sver, PERL_REVISION,
                    PERL_VERSION, PERL_SUBVERSION);
            }
-           if (ckWARN(WARN_PORTABLE))
-               Perl_warner(aTHX_ packWARN(WARN_PORTABLE),
-                        "v-string in use/require non-portable");
            RETPUSHYES;
        }
        else if (!SvPOKp(sv)) {                 /* require 5.005_03 */

==== //depot/maint-5.8/perl/t/lib/warnings/toke#5 (text) ====
Index: perl/t/lib/warnings/toke
--- perl/t/lib/warnings/toke#4~20126~   Thu Jul 10 15:20:02 2003
+++ perl/t/lib/warnings/toke    Wed Aug  6 03:44:50 2003
@@ -806,5 +806,6 @@
 no warnings 'deprecated';
 $v = v65.66;
 EXPECT
-v-strings are deprecated at - line 3.
+v-strings are deprecated (especially those starting with 'v') at - line 3.
+Version objects are deprecated outside of use/require at - line 3.
 

==== //depot/maint-5.8/perl/toke.c#31 (text) ====
Index: perl/toke.c
--- perl/toke.c#30~20493~       Tue Aug  5 01:43:49 2003
+++ perl/toke.c Wed Aug  6 03:44:50 2003
@@ -4797,6 +4797,7 @@
 
        case KEY_require:
            s = skipspace(s);
+           PL_in_require = 1;
            if (isDIGIT(*s)) {
                s = force_version(s, FALSE);
            }
@@ -4810,6 +4811,7 @@
                else if (*s == '<')
                    yyerror("<> should be quotes");
            }
+           PL_in_require = 0;
            UNI(OP_REQUIRE);
 
        case KEY_reset:
@@ -5172,6 +5174,7 @@
            if (PL_expect != XSTATE)
                yyerror("\"use\" not allowed in expression");
            s = skipspace(s);
+           PL_in_require = 1;
            if (isDIGIT(*s) || (*s == 'v' && isDIGIT(s[1]))) {
                s = force_version(s, TRUE);
                if (*s == ';' || (s = skipspace(s), *s == ';')) {
@@ -5187,6 +5190,7 @@
                s = force_word(s,WORD,FALSE,TRUE,FALSE);
                s = force_version(s, FALSE);
            }
+           PL_in_require = 0;
            yylval.ival = 1;
            OPERATOR(USE);
 
@@ -7965,7 +7969,14 @@
 {
     char *pos = s;
     char *start = s;
-    if (*pos == 'v') pos++;  /* get past 'v' */
+
+    if (*pos == 'v') {
+      pos++;  /* get past 'v' */
+      if (ckWARN(WARN_DEPRECATED))
+       Perl_warner(aTHX_ packWARN(WARN_DEPRECATED),
+                   "v-strings are deprecated (especially those starting with 'v')");
+    }
+
     while (pos < PL_bufend && (isDIGIT(*pos) || *pos == '_'))
        pos++;
     if ( *pos != '.') {
@@ -7980,9 +7991,6 @@
        }
     }
 
-    if (ckWARN(WARN_DEPRECATED))
-       Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), "v-strings are deprecated");
-
     if (!isALPHA(*pos)) {
        UV rev;
        U8 tmpbuf[UTF8_MAXLEN+1];
@@ -7992,6 +8000,9 @@
 
        sv_setpvn(sv, "", 0);
 
+       if (!PL_in_require && ckWARN(WARN_DEPRECATED))
+             Perl_warner(aTHX_ packWARN(WARN_DEPRECATED),
+                         "Version objects are deprecated outside of use/require");
        for (;;) {
            rev = 0;
            {
@@ -8010,6 +8021,7 @@
                                    "Integer overflow in decimal number");
                }
            }
+
 #ifdef EBCDIC
            if (rev > 0x7FFFFFFF)
                 Perl_croak(aTHX_ "In EBCDIC the v-string components cannot exceed 
2147483647");
End of Patch.

Reply via email to