--- Paul <[EMAIL PROTECTED]> wrote: > > --- Austin Hastings <[EMAIL PROTECTED]> wrote: > > Likewise, I could argue that it be called C<=:\> (the "disgruntled > > muppet" operator?) since that reflects the "equals, under > reference" > > symbology. But that's yucky. > > Shouldn't that be ==:/ (maybe the "severely startled muppet" > operator? > lol...) A single = would be assignment, but I have no idea how > adverbial modification would affect that. Exactly what *would* > adverbial assignment be? Would > $a =:\ $b > be like > $a = \$b; > > > sub budgetwise(Int $a, Int $b){-1_000_000 <= $a - $b <= 1_000_000;} > > my Int $log_rolling, Int $pork_barrel; > > $log_rolling = random() * 1.0E9; > > $pork_barrel = random() * 1.0E9; > > if ($log_rolling eq:budgetwise $pork_barrel) > > print "They cost the same, give or take a million dollars."; > > Is that saying to make budgetwise the comparison operator at the same > precedence as eq?
Actually, what I think I'm saying in this case is "replace the do() behavior of infix:eq with this sub." Which has kind of startling effects, because then you can also say things like this: sub uniquely(@dest is rw, @src) { my $last = @src[0] ~ "1"; for @src -> $s { @dest.push($last = $s) unless $s == $last; } } my @a = <>; # Read all lines from a file. my @b =:uniquely @a; # Eat the duplicates > > Wouldn't that be much like saying > > my sub infix:um (Int $a, Int $b) is equiv(&infix:eq) { # c.f.A6 > p.11 > -1_000_000 <= $a - $b <= 1_000_000; } > if ($log_rolling um $pork_barrel) # etc Looks right to me, modulo type-casting behavior -- I think yours does typechecking and blows up if the types are misaligned enough, while mine finds the right infix:= operator, and replaces the actual mechanics. (Frankly, I'm not sure what the right behavior of mine is. It may be better to think of it as "temporizing" the infix:= operator for one expression only. More thought required.) > So how does one get a ref in P6 that won't dereference itself??? No idea. I thought that the auto-da-fe^Wautodereference behavior was intended to make "loose references" impossible -- that is, you have to treat a reference object as an object, always. (Which just means more backslashes, I guess.) > The we could say > > my sub infix:embodies ($a,$b) is equiv(&infix:eq) { > $a.ref eq $b.ref # unless eq deref's even here..... > } Maybe you just have to say C<\$a eq \$b> ? > > if ($x embodies $y) { > print "X and Y refer to the same entity\n"; > } > =Austin