[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: Tk800.018 seems to be incompatible with perl 5.005_63 (with patch)



On Tue, 25 Jan 2000 20:32:54 EST, Steve Lidie wrote:
>Ben Pavon wrote:
>> Someone else on the list reported the same issue yesterday.
>> As far as I am concerned (I wrote the current version of Tk::CmdLine),
>> it is that version of Perl that is in error. (Otherwise lots of our
>> code here at work is going to break.)
>> 
>> David Dyck wrote:
>> 
>> > I assume that this is a bug in Tk800.018, and that perl 5.005_63
>> > is just checking things better now, but I've cc'd p5p
>> > to verfiy this isn't a perl problem --
>
>As Nick has already pointed out, from the Tk800.018 README:
>
>>>> TK IS KNOWN NOT TO WORK WITH perl5.005_63 <<<

Nevertheless, this has uncovered a valid problem in 5.005_63.

In a previous change (#3744) I mistakenly made map() behave more like
grep() when it would have been better to make grep() behave like map()
instead.  This highlights the importance of writing tests; that change
didn't have any.  :-(

As suitable penance, here's a fix with tests.


Sarathy
gsar@ActiveState.com
-----------------------------------8<-----------------------------------
Change 4897 by gsar@auger on 2000/01/26 02:42:38

	change#3744 should have made grep more like map instead of the
	other way around

Affected files ...

... //depot/perl/t/op/grep.t#2 edit
... //depot/perl/toke.c#183 edit

Differences ...

==== //depot/perl/t/op/grep.t#2 (xtext) ====
Index: perl/t/op/grep.t
--- perl/t/op/grep.t.~1~	Tue Jan 25 18:42:42 2000
+++ perl/t/op/grep.t	Tue Jan 25 18:42:42 2000
@@ -4,7 +4,7 @@
 # grep() and map() tests
 #
 
-print "1..3\n";
+print "1..27\n";
 
 $test = 1;
 
@@ -29,3 +29,71 @@
    $test++;
 }
 
+{
+   print map({$_} ("ok $test\n"));
+   $test++;
+   print map
+            ({$_} ("ok $test\n"));
+   $test++;
+   print((map({a => $_}, ("ok $test\n")))[0]->{a});
+   $test++;
+   print((map
+            ({a=>$_},
+	     ("ok $test\n")))[0]->{a});
+   $test++;
+   print map { $_ } ("ok $test\n");
+   $test++;
+   print map
+            { $_ } ("ok $test\n");
+   $test++;
+   print((map {a => $_}, ("ok $test\n"))[0]->{a});
+   $test++;
+   print((map
+            {a=>$_},
+	     ("ok $test\n"))[0]->{a});
+   $test++;
+   my $x = "ok \xFF\xFF\n";
+   print map($_&$x,("ok $test\n"));
+   $test++;
+   print map
+            ($_ & $x, ("ok $test\n"));
+   $test++;
+   print map { $_ & $x } ("ok $test\n");
+   $test++;
+   print map
+             { $_&$x } ("ok $test\n");
+   $test++;
+
+   print grep({$_} ("ok $test\n"));
+   $test++;
+   print grep
+            ({$_} ("ok $test\n"));
+   $test++;
+   print grep({a => $_}->{a}, ("ok $test\n"));
+   $test++;
+   print grep
+	     ({a => $_}->{a},
+	     ("ok $test\n"));
+   $test++;
+   print grep { $_ } ("ok $test\n");
+   $test++;
+   print grep
+             { $_ } ("ok $test\n");
+   $test++;
+   print grep {a => $_}->{a}, ("ok $test\n");
+   $test++;
+   print grep
+	     {a => $_}->{a},
+	     ("ok $test\n");
+   $test++;
+   print grep($_&"X",("ok $test\n"));
+   $test++;
+   print grep
+            ($_&"X", ("ok $test\n"));
+   $test++;
+   print grep { $_ & "X" } ("ok $test\n");
+   $test++;
+   print grep
+             { $_ & "X" } ("ok $test\n");
+   $test++;
+}

==== //depot/perl/toke.c#183 (text) ====
Index: perl/toke.c
--- perl/toke.c.~1~	Tue Jan 25 18:42:42 2000
+++ perl/toke.c	Tue Jan 25 18:42:42 2000
@@ -4084,7 +4084,7 @@
 	    Rop(OP_SGE);
 
 	case KEY_grep:
-	    LOP(OP_GREPSTART, *s == '(' ? XTERM : XREF);
+	    LOP(OP_GREPSTART, XREF);
 
 	case KEY_goto:
 	    s = force_word(s,WORD,TRUE,FALSE,FALSE);
@@ -4246,7 +4246,7 @@
 	    TERM(sublex_start());
 
 	case KEY_map:
-	    LOP(OP_MAPSTART, *s == '(' ? XTERM : XREF);
+	    LOP(OP_MAPSTART, XREF);
 
 	case KEY_mkdir:
 	    LOP(OP_MKDIR,XTERM);
End of Patch.


References to:
Steve Lidie <Stephen.O.Lidie@Lehigh.EDU>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]