Skip to content

P6C update concat and bitwise operators #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
p6rt opened this issue Dec 17, 2003 · 16 comments
Closed

P6C update concat and bitwise operators #10

p6rt opened this issue Dec 17, 2003 · 16 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 17, 2003

Migrated from rt.perl.org#24683 (status was 'resolved')

Searchable as RT24683$

@p6rt
Copy link
Author

p6rt commented Dec 17, 2003

From @allison

This patch updates the following operators and their assignment
counterparts​:

_ becomes ~ (concatenation)
& becomes +& ~& (bitwise AND, numeric and string)
| becomes +| ~| (bitwise OR, numeric and string)
~ becomes +^ ~^ (bitwise XOR, numeric and string)

Unary +^ (bitwise negation, a.k.a. ones complement) is not implemented
yet.

I've added two test files, bitwise.t and concat.t, which go in t/op/
(the op/ directory doesn't exist yet).

(My code for bitwise string operators was greatly simplified when Leo
implemented the bitwise_xors, bitwise_ands, and bitwise_ors (string
versions) vtable functions for PerlString. Hip-hip-hooray!)

Allison

@p6rt
Copy link
Author

p6rt commented Dec 17, 2003

From @allison

p6c_update_concat_bitwise.patch
Index: languages/perl6/P6C/Addcontext.pm
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/P6C/Addcontext.pm,v
retrieving revision 1.21
diff -u -r1.21 Addcontext.pm
--- languages/perl6/P6C/Addcontext.pm	27 Nov 2003 19:43:20 -0000	1.21
+++ languages/perl6/P6C/Addcontext.pm	17 Dec 2003 01:07:07 -0000
@@ -40,13 +40,13 @@
     # type => [list-of-ops].
     my %opmap =
 	( # Ops that work differently for different scalar types:
-	 PerlUndef => [ qw(| & ~ // ..),
+	 PerlUndef => [ qw(| & +^ ~^ // ..),
 	  # Unfortunately, these work differently on ints and nums:
 			qw(+ - * / % **)],
 
 	 PerlInt => [ qw(<< >>) ],
 
-	 PerlString => [ qw(_) ],
+	 PerlString => [ qw(~) ],
 
 	 # NOTE: Actually, according to apo 3, boolean operators
 	 # propagate values in their surrounding context (even though
@@ -900,7 +900,7 @@
 			      @ PerlArray
                               * PerlArray
 			      $ PerlUndef
-			      _ PerlString
+			      ~ PerlString
 			      ? bool
 			      + PerlNum);
 }
Index: languages/perl6/P6C/IMCC.pm
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/P6C/IMCC.pm,v
retrieving revision 1.30
diff -u -r1.30 IMCC.pm
--- languages/perl6/P6C/IMCC.pm	27 Nov 2003 19:43:20 -0000	1.30
+++ languages/perl6/P6C/IMCC.pm	17 Dec 2003 01:07:11 -0000
@@ -1341,16 +1341,6 @@
 use P6C::Util ':all';
 use P6C::Context;
 
-# Create generic code for $a op $b.
-sub simple_binary {
-    my $x = shift;
-    my $ltmp = $x->l->val;
-    my $rtmp = $x->r->val;
-    my $dest = newtmp 'PerlUndef';
-    my $op = imcc_op($x->op);
-    code("\t$dest = $ltmp $op $rtmp\n");
-    return $dest;
-}
 
 # '=' assignment op.
 sub do_assign {
@@ -1392,12 +1382,14 @@
 
  '>>'	=> \&simple_binary,
  '<<'	=> \&simple_binary,
- '|'	=> \&simple_binary,
- '&'	=> \&simple_binary,
- '~'	=> \&simple_binary,
+ '+&'	=> \&simple_binary,
+ '~&'	=> \&simple_binary_pasm,
+ '+|'	=> \&simple_binary,
+ '~|'	=> \&simple_binary_pasm,
+ '+^'	=> \&simple_binary,
+ '~^'	=> \&simple_binary_pasm,
 
-# '_' => \&simple_binary, # PMC concat broken.
- '_'	=> \&do_concat,
+ '~'	=> \&do_concat,
  '='	=> \&do_assign,
  '||'	=> \&do_logor,
  '&&'	=> \&do_logand,
@@ -1413,7 +1405,7 @@
 
 use vars '%op_is_array';
 BEGIN {
-    my @arrayops = qw(= .. x // ^^ && || _);
+    my @arrayops = qw(= .. x // ^^ && || ~);
     push(@arrayops, ',');
     @op_is_array{@arrayops} = (1) x @arrayops;
 }
Index: languages/perl6/P6C/Parser.pm
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/P6C/Parser.pm,v
retrieving revision 1.28
diff -u -r1.28 Parser.pm
--- languages/perl6/P6C/Parser.pm	27 Nov 2003 19:43:20 -0000	1.28
+++ languages/perl6/P6C/Parser.pm	17 Dec 2003 01:07:13 -0000
@@ -251,22 +251,23 @@
     $VCLOSE	= qr/<</;
     $NAMEPART	= qr/[a-zA-Z_][\w_]*/;
     $COMPARE	= qr{(?:cmp|eq|[gnl]e|[gl]t)\b|<=>|[<>=!]=|<|>};
-    $CONTEXT	= qr{[\%\@\$\&*_?]|\+(?!\+)};
+    $CONTEXT	= qr{[\%\@\$\&*?]|\+(?!\+)|~(?![~\&\|\^])};
     $MULDIV	= qr{[\%*x]|/(?!/)};
     $MATCH	= qr{[=!]~};
     $INCR	= qr{\+\+|--};
-    $PREFIX	= qr{ [!~\\]   |    # logical negation '!', bitwise negation '~', create a reference '\'
+    $PREFIX	= qr{ [!\\]    |    # logical negation '!', create a reference '\'
+                      \+\^     |    # unary bitwise XOR (bitwise negation)
                       \+(?!\+) |    # posification '+', but not increment '++' 
                       -(?![->])     # negation '-', but not decrement '--', but not dereference '->'
                     }x;
-    $ADDSUB	= qr{[-+_]};
+    $ADDSUB	= qr{[-+~](?![\&\|\^])};
     $BITSHIFT	= qr{<<|>>};
     $LOG_OR	= qr{(?:x?or|err)\b};
     $LOGOR	= qr{\|\||\^\^|//};
-    $BITOR	= qr{(?:\|(?!\|)|~(?!~))};
-    $BITAND	= qr{&(?!&)};
+    $BITOR	= qr{(?:\|(?!\|)|[~\+][\|\^])};
+    $BITAND	= qr{(?:\+\&|~\&)};
     $FILETEST	= qr{-[rwxoRWXOezsfdlpSbctugkTBMAC]+\b};
-    $ASSIGN	= qr{(?:!|:|//|&&?|\|\|?|~|\^\^|<<|>>|$ADDSUB|$MULDIV|\*\*)?=};
+    $ASSIGN	= qr{(?:!|:|//|&&?|\|\|?|\+[\&\|\^]|~[\&\|\^]|\^\^|<<|>>|$ADDSUB|$MULDIV|\*\*)?=};
     # Used for flushing syntax errors
     $FLUSH	= qr/\w+|[^\s\w;}#'"]+/;
     $NUMPART	= qr/(?!_)[\d_]+(?<!_)/;
@@ -523,7 +524,7 @@
 muldiv_op:	  /$MULDIV|$VOPEN$MULDIV$VCLOSE/o
 
 addsub:		  <leftop: muldiv addsub_op muldiv>
-# addsub_op:	  '+' | '-' | '_'
+# addsub_op:	  '+' | '-' | '~'
 addsub_op:	  /$ADDSUB|$VOPEN$ADDSUB$VCLOSE/o
 
 bitshift:	  <leftop: addsub bitshift_op addsub>
Index: languages/perl6/P6C/IMCC/Binop.pm
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/P6C/IMCC/Binop.pm,v
retrieving revision 1.14
diff -u -r1.14 Binop.pm
--- languages/perl6/P6C/IMCC/Binop.pm	27 Nov 2003 19:43:22 -0000	1.14
+++ languages/perl6/P6C/IMCC/Binop.pm	17 Dec 2003 01:07:14 -0000
@@ -10,7 +10,7 @@
 use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK);
 @ISA = qw(Exporter);
 @EXPORT_OK = qw(do_pow do_logand do_logor do_defined do_concat do_repeat
-		do_range do_smartmatch imcc_op);
+		do_range do_smartmatch imcc_op simple_binary simple_binary_pasm);
 %EXPORT_TAGS = (all => [@EXPORT_OK]);
 
 sub do_pow ;
@@ -28,14 +28,49 @@
 sub sm_expr_num ;
 sub sm_expr_str ;
 
-# Remap operator names from P6 to IMCC.
+# Remap operator symbols from P6 to IMCC.
 sub imcc_op {
 	my $op = shift;
-
 	return "~~" if ($op eq '^^');
-	return "." if ($op eq '_');
+	return "."  if ($op eq '~');
+	return "|"  if ($op eq '+|');
+	return "&"  if ($op eq '+&');
+	return "~"  if ($op eq '+^');
+	return $op;
+}
 
+# Remap operator symbols from P6 to PASM opcodes
+sub pasm_op {
+	my $op = shift;
+	return "bands" if ($op eq '~&');
+	return "bors"  if ($op eq '~|');
+	return "bxors" if ($op eq '~^');
 	return $op;
+}
+
+#
+# Create generic code for $a op $b.
+sub simple_binary {
+    my $x = shift;
+    my $ltmp = $x->l->val;
+    my $rtmp = $x->r->val;
+    my $dest = newtmp 'PerlUndef';
+    my $op = imcc_op($x->op);
+    code("\t$dest = $ltmp $op $rtmp\n");
+    return $dest;
+}
+
+#
+# Some p6 operators correspond to a single PASM opcode but don't
+# have PIR syntax.
+sub simple_binary_pasm {
+    my $x = shift;
+    my $dest = newtmp 'PerlUndef';
+    my $ltmp = $x->l->val;
+    my $rtmp = $x->r->val;
+    my $opcode = pasm_op($x->op);
+    code("\t$opcode $dest, $ltmp, $rtmp\n");
+    return $dest;
 }
 
 1;
Index: languages/perl6/P6C/IMCC/hype.pm
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/P6C/IMCC/hype.pm,v
retrieving revision 1.5
diff -u -r1.5 hype.pm
--- languages/perl6/P6C/IMCC/hype.pm	27 Nov 2003 19:43:22 -0000	1.5
+++ languages/perl6/P6C/IMCC/hype.pm	17 Dec 2003 01:07:14 -0000
@@ -21,9 +21,9 @@
 
 use vars '%optype';
 BEGIN {
-    my %opmap = (int => [ qw(>> << | & ~ ^^)],
+    my %opmap = (int => [ qw(>> << +| +& +^ ^^)],
 		 num => [ qw(+ - * / % **)],
-		 str => [ qw(_) ]);
+		 str => [ qw(~ ~| ~& ~^) ]);
     while (my ($t, $ops) = each %opmap) {
 	@optype{@$ops} = ($t) x @$ops;
     }
@@ -120,7 +120,7 @@
 	return hype_scalar_array(@_);
     } else {
 	diag "Tried to hyper-operate two scalars";
-	return P6C::Binop::simple_binary(@_);
+	return P6C::IMCC::Binop::simple_binary(@_);
     }
 }
 
Index: languages/perl6/P6C/Tree/String.pm
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/P6C/Tree/String.pm,v
retrieving revision 1.8
diff -u -r1.8 String.pm
--- languages/perl6/P6C/Tree/String.pm	13 Oct 2003 17:00:52 -0000	1.8
+++ languages/perl6/P6C/Tree/String.pm	17 Dec 2003 01:07:15 -0000
@@ -153,9 +153,10 @@
     my ($list) = @_;
     my $type = 'PerlString';
     if (@$list > 1) {
-        my $val = new P6C::Binop op => '_', l => make_node(shift @$list), r => make_node(shift @$list);
+	# XXX: hardcoded P6 op, nasty
+        my $val = new P6C::Binop op => '~', l => make_node(shift @$list), r => make_node(shift @$list);
         while (@$list) {
-            $val = new P6C::Binop op => '_', l => $val, r => make_node(shift @$list)
+            $val = new P6C::Binop op => '~', l => $val, r => make_node(shift @$list)
         }
         return $val;
     }
Index: languages/perl6/examples/qsort.p6
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/examples/qsort.p6,v
retrieving revision 1.2
diff -u -r1.2 qsort.p6
--- languages/perl6/examples/qsort.p6	18 Feb 2003 13:25:13 -0000	1.2
+++ languages/perl6/examples/qsort.p6	17 Dec 2003 01:07:15 -0000
@@ -21,8 +21,8 @@
 sub main() {
     my @a = 1..(@ARGS[0] || 100);
     qsort @a, 0, @a - 1;
-    print @a ^_ "\n";
+    print @a >>~<< "\n";
     @a = reverse @a;
     qsort @a, 0, @a - 1;
-    print @a ^_ "\n";
+    print @a >>~<< "\n";
 }
Index: languages/perl6/t/compiler/aggregates.t
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/t/compiler/aggregates.t,v
retrieving revision 1.1
diff -u -r1.1 aggregates.t
--- languages/perl6/t/compiler/aggregates.t	13 Oct 2003 17:00:57 -0000	1.1
+++ languages/perl6/t/compiler/aggregates.t	17 Dec 2003 01:07:15 -0000
@@ -9,7 +9,7 @@
     my $a = (2,3,4);
     my ($b, $c) = (2,3,4);
     my ($d, $e, $f) = (5,6);
-    print1(@a[0] _ ' ' _ @a[1] _ ' ' _ @a[2]);
+    print1(@a[0] ~ ' ' ~ @a[1] ~ ' ' ~ @a[2]);
     print1($a);
     print1($b);
     print1($c);
@@ -33,9 +33,9 @@
 sub main() {
     my @a = (1,2,3,4);
     my @b = @a[0,2];
-    print1(@b[0] _ ', ' _ @b[1]);
-    print1(@a[0] _ ', ' _ @a[2]);
-    print1(@a[1] _ ', ' _ @a[3]);
+    print1(@b[0] ~ ', ' ~ @b[1]);
+    print1(@a[0] ~ ', ' ~ @a[2]);
+    print1(@a[1] ~ ', ' ~ @a[3]);
     my @c = @a;
     @a[2] = 5;
     @c[0] = 6;
@@ -58,7 +58,7 @@
     %x{a} = 'ay?';
     %x{b} = 'be!';
     %x{$x} = 'twenty-three';
-    print1(%x{a} _', ' _%x{$b} _', ' _%x{23});
+    print1(%x{a} ~', ' ~%x{$b} ~', ' ~%x{23});
 }
 
 CODE
@@ -75,7 +75,7 @@
     %x{b} = 'be!';
     %x{$x} = 'twenty-three';
     my @x = %x{'b', 'a', $x};
-    print1(@x[0] _@x[1] _@x[2]);
+    print1(@x[0] ~@x[1] ~@x[2]);
     my %y = %x;
     %y{a} = 'ay!';
     %x{b} = 'be?';
@@ -92,7 +92,7 @@
 ##############################
 output_is(<<'CODE', <<'OUT', "Flattening");
 sub foo {
-    print1(@_[0]_' '_@_[2]);
+    print1(@_[0]~' '~@_[2]);
 }
 
 sub main() {
@@ -137,9 +137,9 @@
     my @b = @a[@i];
     my @c = @a[1..3];
     my ($d, $e) = @a[1..3];
-    print1(@b[0] _ ' ' _ @b[1] _ ' ' _ @b[2]);
-    print1(@c[0] _ ' ' _ @c[1] _ ' ' _ @c[2]);
-    print1($d _ ' ' _ $e);
+    print1(@b[0] ~ ' ' ~ @b[1] ~ ' ' ~ @b[2]);
+    print1(@c[0] ~ ' ' ~ @c[1] ~ ' ' ~ @c[2]);
+    print1($d ~ ' ' ~ $e);
 }
 
 CODE
Index: languages/perl6/t/compiler/basic.t
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/t/compiler/basic.t,v
retrieving revision 1.2
diff -u -r1.2 basic.t
--- languages/perl6/t/compiler/basic.t	27 Nov 2003 19:43:25 -0000	1.2
+++ languages/perl6/t/compiler/basic.t	17 Dec 2003 01:07:15 -0000
@@ -6,7 +6,7 @@
 ##############################
 output_is(<<'CODE', <<'OUT', "Basic hello.");
 sub main() {
-    print1("Hello, " _ "world");
+    print1("Hello, " ~ "world");
 }
 CODE
 Hello, world
@@ -37,7 +37,7 @@
     print1(2 * 3);
     print1(6 / 2);
     print1(2 % 3);
-    print1(2 _ 3);
+    print1(2 ~ 3);
     print1(2 ** 3);
     print1(2 ** 3 ** 1);
     print1(2 ** 1 ** 3);
@@ -65,7 +65,7 @@
     print1 "ok 3" if (--$x == 2);
     my $y = $x++;
     print1 "ok 4" if ($x == 3 && $y == 2);
-    print1 ("ok "_ ($x++ + $y++));
+    print1 ("ok "~ ($x++ + $y++));
     print1 "ok 6" if ($x == 4 && $y == 3);
 }
 CODE
@@ -84,15 +84,15 @@
     my $y = $x;
     my @z = ($x, $y);
     # actually above statement makes next fail -lt
-    print1 (++$x _ ' ' _ $y);
+    print1 (++$x ~ ' ' ~ $y);
     $x--;
-    print ++$x _ ' ' _ $y _ "\n";
-    print $x++ _ ' ' _ $y _ "\n";
-    print $x _ ' ' _ $y++ _ "\n";
-    print $x _ ' ' _ ++$y _ "\n";
-    print @z[0]++ _ ' ' _ ++@z[1] _ "\n";
-    print $x _ ' ' _ $y _ "\n";
-    print @z[0] _ ' ' _ @z[1] _ "\n";
+    print ++$x ~ ' ' ~ $y ~ "\n";
+    print $x++ ~ ' ' ~ $y ~ "\n";
+    print $x ~ ' ' ~ $y++ ~ "\n";
+    print $x ~ ' ' ~ ++$y ~ "\n";
+    print @z[0]++ ~ ' ' ~ ++@z[1] ~ "\n";
+    print $x ~ ' ' ~ $y ~ "\n";
+    print @z[0] ~ ' ' ~ @z[1] ~ "\n";
 }
 CODE
 3 2
@@ -110,9 +110,9 @@
 sub main() {
     print1(2 << 3);
     print1(32 >> 3);
-    print1(32 | 3);
-    print1(31 & 3);
-    print1(10 ~ 12);		# 1010 ~ 1100 -> 0110 == 6
+    print1(32 +| 3);
+    print1(31 +& 3);
+    print1(10 +^ 12);		# 1010 +^ 1100 -> 0110 == 6
 }
 CODE
 16
@@ -256,19 +256,19 @@
     my $a = 3;
     if 1 {
 	my $a = 4;
-	if 2 { my $a = 5; print1("a is " _ $a) }
-	print1("a is " _ $a);
+	if 2 { my $a = 5; print1("a is " ~ $a) }
+	print1("a is " ~ $a);
     }
-    print1("a is " _ $a);
+    print1("a is " ~ $a);
     if 1 {
 	my $a = 5;
-	print1("a is " _ $a);
+	print1("a is " ~ $a);
     }
-    print1("a is " _ $a);
+    print1("a is " ~ $a);
     if 1 {
 	$a = 6;
     }
-    print1("a is " _ $a);
+    print1("a is " ~ $a);
 }
 CODE
 a is 5
Index: languages/perl6/t/compiler/call.t
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/t/compiler/call.t,v
retrieving revision 1.1
diff -u -r1.1 call.t
--- languages/perl6/t/compiler/call.t	13 Oct 2003 17:00:57 -0000	1.1
+++ languages/perl6/t/compiler/call.t	17 Dec 2003 01:07:16 -0000
@@ -7,7 +7,7 @@
 output_is(<<'CODE', <<'OUT', "subroutine call");
 sub _fact($tot, $max, $n) {
     if $n > $max {
-	print1($max _ "! = " _ $tot);
+	print1($max ~ "! = " ~ $tot);
     } else {
 	_fact $tot * $n, $max, $n + 1;
     }
@@ -15,7 +15,7 @@
 
 sub fact($n) {
     unless 0 <= $n < 20 {
-	print1("Sorry, can't take " _ $n _ " factorial");
+	print1("Sorry, can't take " ~ $n ~ " factorial");
     } else {
 	_fact 1, $n, 1
     }
@@ -38,7 +38,7 @@
 ##############################
 output_is(<<'CODE', <<'OUT', "no args");
 sub noargs() {
-    print "ok " _ $i++ _ "\n";
+    print "ok " ~ $i++ ~ "\n";
 }
 
 sub main() {
@@ -62,7 +62,7 @@
 }
 
 sub noargs() {
-    print "ok " _ $i++ _ "\n";
+    print "ok " ~ $i++ ~ "\n";
 }
 
 CODE
@@ -288,15 +288,15 @@
 }
 
 sub one($x) {
-    print1('one ' _$x);
+    print1('one ' ~$x);
 }
 
 sub two($x, $y) {
-    print1('two ' _$x _' ' _$y);
+    print1('two ' ~$x ~' ' ~$y);
 }
 
 sub three($x, $y, $z) {
-    print1('three ' _$x _' ' _$y _' ' _$z);
+    print1('three ' ~$x ~' ' ~$y ~' ' ~$z);
 }
 
 sub main() {
Index: languages/perl6/t/compiler/exceptions.t
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/t/compiler/exceptions.t,v
retrieving revision 1.1
diff -u -r1.1 exceptions.t
--- languages/perl6/t/compiler/exceptions.t	13 Oct 2003 17:00:57 -0000	1.1
+++ languages/perl6/t/compiler/exceptions.t	17 Dec 2003 01:07:16 -0000
@@ -18,7 +18,7 @@
 	die;
 	CATCH { default { 2 } }
     }
-    print $x _' ' _$y, "\n";
+    print $x ~' ' ~$y, "\n";
 }
 CODE
 dying
Index: languages/perl6/t/compiler/for.t
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/t/compiler/for.t,v
retrieving revision 1.1
diff -u -r1.1 for.t
--- languages/perl6/t/compiler/for.t	13 Oct 2003 17:00:57 -0000	1.1
+++ languages/perl6/t/compiler/for.t	17 Dec 2003 01:07:16 -0000
@@ -78,7 +78,7 @@
 output_is(<<'CODE', <<'OUT', "For 1;1 -> 2;3");
 sub main() {
     for 11..20 ; 1..15 -> $a, $b ; $c, $d, $e {
-	print1($a _ ' ' _ $c);
+	print1($a ~ ' ' ~ $c);
     }
 }
 
Index: languages/perl6/t/compiler/globals.t
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/t/compiler/globals.t,v
retrieving revision 1.2
diff -u -r1.2 globals.t
--- languages/perl6/t/compiler/globals.t	27 Nov 2003 19:43:25 -0000	1.2
+++ languages/perl6/t/compiler/globals.t	17 Dec 2003 01:07:16 -0000
@@ -6,7 +6,7 @@
 ##############################
 output_is(<<'CODE', <<'OUT', "globals");
 sub foo() {
-    print $x, " is ", @xs >>_<< ' ', "\n";
+    print $x, " is ", @xs >>~<< ' ', "\n";
     $y = 0;
     for @xs { $y = $y + $_ }
 }
Index: languages/perl6/t/compiler/hyper.t
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/t/compiler/hyper.t,v
retrieving revision 1.3
diff -u -r1.3 hyper.t
--- languages/perl6/t/compiler/hyper.t	27 Nov 2003 19:43:25 -0000	1.3
+++ languages/perl6/t/compiler/hyper.t	17 Dec 2003 01:07:16 -0000
@@ -6,7 +6,7 @@
 ##############################
 output_is(<<'CODE', <<'OUT', 'Hyper 1');
 sub parray(@y) {
-    print1('(' _ @y[0] _ ', ' _ @y[1] _ ')');
+    print1('(' ~ @y[0] ~ ', ' ~ @y[1] ~ ')');
 }
 sub main() {
     my @a = (1,2);
@@ -20,7 +20,7 @@
 #    print1(@a >>*<< @x  + @b); # Array math not in 0.0.7
 # IMCC clobbers too many registers with this:
 #     @y = @a >><<<< @a;
-#     print1('(' _ @y[0] _ ', ' _ @y[1] _ ')');
+#     print1('(' ~ @y[0] ~ ', ' ~ @y[1] ~ ')');
 }
 CODE
 (8, 14)
@@ -51,7 +51,7 @@
 ##############################
 output_is(<<'CODE', <<'OUT', 'Hyper 3');
 sub parray(@y) {
-    print1('(' _ @y[0] _ ', ' _ @y[1] _ ', ' _ @y[2] _ ')');
+    print1('(' ~ @y[0] ~ ', ' ~ @y[1] ~ ', ' ~ @y[2] ~ ')');
 }
 
 sub main() {
@@ -82,17 +82,17 @@
     my @a = (1..3);
     my @b = (4..9);
     my @c = @a >>+<< @b;
-    print @c >>_<< ' ',"x\n";
+    print @c >>~<< ' ',"x\n";
     @c = @b >>+<< @a;
-    print @c >>_<< ' ',"x\n";
+    print @c >>~<< ' ',"x\n";
     @b = @b >>+<< @a;
-    print @b >>_<< ' ',"x\n";
+    print @b >>~<< ' ',"x\n";
     @b = (4..9);
     @b >>+=<< @a;
-    print @b >>_<< ' ',"x\n";
+    print @b >>~<< ' ',"x\n";
     @b = (4..9);
     @a >>+=<< @b;
-    print @a >>_<< ' ',"x\n";
+    print @a >>~<< ' ',"x\n";
 }
 CODE
 5 7 9 7 8 9 x
@@ -109,30 +109,30 @@
 my @c;
 @c = @a;
 @c >>+=<< @b;
-print @c >>_<< ' ',"x\n";
+print @c >>~<< ' ',"x\n";
 @c = @b;
 @c >>+=<< @a;
-print @c >>_<< ' ',"x\n";
+print @c >>~<< ' ',"x\n";
 
 @c = @a;
 @c >>*=<< @b;
-print @c >>_<< ' ',"x\n";
+print @c >>~<< ' ',"x\n";
 
 @c = @a;
 @c >>**=<< @b;
-print @c >>_<< ' ',"x\n";
+print @c >>~<< ' ',"x\n";
 
 @c = @a;
 @c >>/=<< @b;
-print @c >>_<< ' ',"x\n";
+print @c >>~<< ' ',"x\n";
 
 @c = @b;
 @c >>%=<< @a;
-print @c >>_<< ' ',"x\n";
+print @c >>~<< ' ',"x\n";
 
 @c = @b;
 @c >>-=<< @a;
-print @c >>_<< ' ',"x\n";
+print @c >>~<< ' ',"x\n";
 CODE
 /7 9 4 x
 7 9 4 x
Index: languages/perl6/t/compiler/qsort.t
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/t/compiler/qsort.t,v
retrieving revision 1.2
diff -u -r1.2 qsort.t
--- languages/perl6/t/compiler/qsort.t	27 Nov 2003 19:43:25 -0000	1.2
+++ languages/perl6/t/compiler/qsort.t	17 Dec 2003 01:07:16 -0000
@@ -27,10 +27,10 @@
 sub main() {
     my @a = 1..10;
     qsort @a, 0, @a - 1;
-    print @a >>_<< "\n";
+    print @a >>~<< "\n";
     @a = (10,9,8,7,6,5,4,3,2,1);
     qsort @a, 0, @a - 1;
-    print @a >>_<< "\n";
+    print @a >>~<< "\n";
 }
 CODE
 10
Index: languages/perl6/t/compiler/string.t
===================================================================
RCS file: /cvs/public/parrot/languages/perl6/t/compiler/string.t,v
retrieving revision 1.1
diff -u -r1.1 string.t
--- languages/perl6/t/compiler/string.t	13 Oct 2003 17:00:57 -0000	1.1
+++ languages/perl6/t/compiler/string.t	17 Dec 2003 01:07:16 -0000
@@ -12,7 +12,7 @@
     # qq + interpolation
     print(qq|$speech $action $person\n"But you speak like a fool."\n|);
     # obviously refering to those folks who think Perl6 is a "bad thing." :)
-    print "\"pass " _ 'test"' _ "\n"; # backslash quotes + spacing
+    print "\"pass " ~ 'test"' ~ "\n"; # backslash quotes + spacing
 }
 CODE
 "You have not seen, so I forgive your jest," said Gimli.

@p6rt
Copy link
Author

p6rt commented Dec 17, 2003

From @allison

#!perl
use strict;
use P6C​::TestCompiler tests => 7;
use Test​::More;

##############################
output_is(<<'CODE', <<'OUT', "bitwise AND, numeric");
  my $numeric = 42 +& 18;
  print $numeric ~ "\n";
  my $assign = 42;
  $assign +&= 36;
  print $assign ~ "\n";
CODE
2
32
OUT

##############################
output_is(<<'CODE', <<'OUT', "bitwise AND, string");
  my $string = "j" ~& "g"; # 0b1101010 bitwise OR 0b1100111
  print $string ~ "\n"; # results in 0b1100010
  my $assign = "jj";
  $assign ~&= "gg";
  print $assign ~ "\n";
CODE
b
bb
OUT

##############################
output_is(<<'CODE', <<'OUT', "bitwise OR, numeric");
  my $numeric = 42 +| 18;
  print $numeric ~ "\n";
  my $assign = 42;
  $assign +|= 36;
  print $assign ~ "\n";
CODE
58
46
OUT

##############################
output_is(<<'CODE', <<'OUT', "bitwise OR, string");
  my $string = "a" ~| "b"; # 0b1100001 bitwise OR 0b1100010
  print $string ~ "\n"; # results in 0b1100011
  my $assign = "aa";
  $assign ~|= "bb";
  print $assign ~ "\n";
CODE
c
cc
OUT

##############################
output_is(<<'CODE', <<'OUT', "bitwise XOR, numeric");
  my $numeric = 42 +^ 18;
  print $numeric ~ "\n";
  my $assign = 42;
  $assign +^= 36;
  print $assign ~ "\n";
CODE
56
14
OUT

##############################
SKIP​: {
  skip("cannot do unary bitwise XOR yet", 1);
output_is(<<'CODE', <<'OUT', "unary bitwise XOR (bitwise negation/ones complement)");
  my $numeric = +^ 42;
  print $numeric ~ "\n";
CODE
4294967253
OUT
} # SKIP

##############################
output_is(<<'CODE', <<'OUT', "bitwise XOR, string");
  my $string = "G" ~^ "*" ; # 0b1000111 bitwise XOR 0b0101010
  print $string ~ "\n"; # results in 0b1101101
  my $assign = "GG";
  $assign ~^= "**";
  print $assign ~ "\n";
CODE
m
mm
OUT

@p6rt
Copy link
Author

p6rt commented Dec 17, 2003

From @allison

#!perl
use strict;
use P6C​::TestCompiler tests => 2;
use Test​::More;

##############################
output_is(<<'CODE', <<'OUT', "concatenation, simple single string");
  print "\"pass " ~ 'test"' ~ "\n"; # backslash quotes + spacing
CODE
"pass test"
OUT

##############################
output_is(<<'CODE', <<'OUT', "concatenation assignment");
  my $string = "Narf, ";
  $string ~= "Poit!\n";
  print $string;
CODE
Narf, Poit!
OUT

@p6rt
Copy link
Author

p6rt commented Dec 19, 2003

From @leo

Allison Randal <bugs-perl6@​bugs6.perl.org> wrote​:

This patch updates the following operators and their assignment
counterparts​:

Applied, thanks.

I've added two test files, bitwise.t and concat.t, which go in t/op/
(the op/ directory doesn't exist yet)

Missing?

leo

@p6rt
Copy link
Author

p6rt commented Dec 19, 2003

From @allison

Leo wrote​:

I've added two test files, bitwise.t and concat.t, which go in t/op/
(the op/ directory doesn't exist yet)

Missing?

The directory needs to be added. We're gradually moving our way toward
the test hierarchy planned on p6d​:

t/var
t/op
t/subs
t/regex
t/module
t/class
...

Or, more extensively​:
  http://p6stories.kwiki.org/index.cgi?ProposedTestHierarchy

We haven't gotten to moving all the tests yet, but I'll add new test
files in the new hierarchy.

Allison

@p6rt
Copy link
Author

p6rt commented Dec 20, 2003

From @pdcawley

Allison Randal <al@​shadowed.net> writes​:

Leo wrote​:

I've added two test files, bitwise.t and concat.t, which go in t/op/
(the op/ directory doesn't exist yet)

Missing?

The directory needs to be added. We're gradually moving our way toward
the test hierarchy planned on p6d​:

p6d?

@p6rt
Copy link
Author

p6rt commented Dec 20, 2003

From @leo

Allison Randal <al@​shadowed.net> wrote​:

Leo wrote​:

I've added two test files, bitwise.t and concat.t, which go in t/op/
(the op/ directory doesn't exist yet)

Missing?

The directory needs to be added. We're gradually moving our way toward
the test hierarchy planned on p6d​:

t/var
t/op

I had a short look at the subdir hierarchy, looks good.
(perl6​:run_tests, Makefile, and t/harness have to learn how to deal with
differently deep nested test files though).

If you don't have CVS write access, I'd vote for you getting it. In the
meantime just append new test files with a note that the subdir needs
to be created first.

Allison

leo

@p6rt
Copy link
Author

p6rt commented Dec 20, 2003

From @allison

Piers wrote​:

p6d?

The perl6-documentation list. Started around Nov. 2002, it had about 3
months of heavy traffic and not much since. But, we did get a good plan
for the direction of p6 testing out of it.

Allison

@p6rt
Copy link
Author

p6rt commented Dec 20, 2003

From @allison

Leo wrote​:

I had a short look at the subdir hierarchy, looks good.

Excellent.

(perl6​:run_tests, Makefile, and t/harness have to learn how to deal with
differently deep nested test files though).

Yeah, that's on my Todo list. Hmmm... I should probably add the list to
the repository.

If you don't have CVS write access, I'd vote for you getting it.

I don't have it. Thanks. :)

Allison

@p6rt
Copy link
Author

p6rt commented Dec 21, 2003

From @pdcawley

Allison Randal <al@​shadowed.net> writes​:

Piers wrote​:

p6d?

The perl6-documentation list. Started around Nov. 2002, it had about
3 months of heavy traffic and not much since. But, we did get a good
plan for the direction of p6 testing out of it.

I find that the best way to remember the answer to a question is to
ask the 'net. Usually, about 10 seconds after the mail leaves my
server I remember what the answer was.

@p6rt
Copy link
Author

p6rt commented Dec 22, 2003

From dan@sidhe.org

At 2​:03 PM -0600 12/19/03, Allison Randal wrote​:

Leo wrote​:

I've added two test files, bitwise.t and concat.t, which go in t/op/
(the op/ directory doesn't exist yet)

Missing?

The directory needs to be added. We're gradually moving our way toward
the test hierarchy planned on p6d​:

Allison, if you've not gotten a perl.org account head over to
bugs.perl.org and get one so we can get you checkin privs. Seems
silly to force a go-between for updates to the perl compiler.
--
  Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
dan@​sidhe.org have teddy bears and even
  teddy bears get drunk

@p6rt
Copy link
Author

p6rt commented Dec 22, 2003

From @allison

Dan wrote​:

Allison, if you've not gotten a perl.org account head over to
bugs.perl.org and get one so we can get you checkin privs. Seems
silly to force a go-between for updates to the perl compiler.

I'm "allison".

Allison

@p6rt
Copy link
Author

p6rt commented Dec 22, 2003

From dan@sidhe.org

At 1​:28 PM -0600 12/22/03, Allison Randal wrote​:

Dan wrote​:

Allison, if you've not gotten a perl.org account head over to
bugs.perl.org and get one so we can get you checkin privs. Seems
silly to force a go-between for updates to the perl compiler.

I'm "allison".

Yes, yes you are. :) Full CVS checkin, or would you prefer to stick
with just the perl 6 section?
--
  Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
dan@​sidhe.org have teddy bears and even
  teddy bears get drunk

@p6rt
Copy link
Author

p6rt commented Dec 22, 2003

From @allison

Dan wrote​:

Full CVS checkin, or would you prefer to stick with just the perl 6
section?

At the moment I don't expect to work on much outside the perl 6 section
except the Perl PMC's and occasional OS X patches. That may change.
<shrug>

Allison

@p6rt p6rt closed this as completed Jan 21, 2004
@p6rt
Copy link
Author

p6rt commented Jan 21, 2004

robert@perl.org - Status changed from 'new' to 'resolved'

@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant