Re: ~ and + vs. generic eq

2005-09-22 Thread Yuval Kogman
On Wed, Sep 21, 2005 at 13:53:20 +0200, TSa wrote: HaloO Yuval, you wrote: On Mon, Aug 29, 2005 at 14:07:51 +0200, TSa wrote: role Object does Compare[Object, =:=] role Numdoes Compare[Num, ==] role Strdoes Compare[Str, eq] What is the implication of from the perspective of

Re: ~ and + vs. generic eq

2005-09-22 Thread TSa
HaloO, Yuval Kogman wrote: No, the role installs homogenious targets into the generic binary-MMD comparator which I think is called eqv. Err, why? We already have that with regular MMD semantics. role Num { multi *infix:eqv ($x:, Num $y) { $x == $y } } What you mean is double

Re: ~ and + vs. generic eq

2005-09-21 Thread TSa
HaloO Yuval, you wrote: On Mon, Aug 29, 2005 at 14:07:51 +0200, TSa wrote: role Object does Compare[Object, =:=] role Numdoes Compare[Num, ==] role Strdoes Compare[Str, eq] What is the implication of from the perspective of the person using Object, Num and Str? Do they have

Re: ~ and + vs. generic eq

2005-08-29 Thread TSa
HaloO, Damian Conway wrote: Just a meta-point...one thing we really do need to be careful of is not ending up with 17 different equality operators (like certain languages I shall refrain from naming). So far we're contemplating: =:= ~~ == eq eqv equals Do we really

Re: ~ and + vs. generic eq

2005-08-29 Thread Yuval Kogman
On Wed, Aug 24, 2005 at 16:57:30 +1000, Damian Conway wrote: This is what the operators mean to me: =:= The right side and the left are the same thing, in the sense that: $x =:= $y; # if this is true $x.mutating_method; # and one side is changed $x =:= $y; #

Re: ~ and + vs. generic eq

2005-08-29 Thread Yuval Kogman
On Mon, Aug 29, 2005 at 14:07:51 +0200, TSa wrote: HaloO, Damian Conway wrote: Just a meta-point...one thing we really do need to be careful of is not ending up with 17 different equality operators (like certain languages I shall refrain from naming). So far we're contemplating:

Re: ~ and + vs. generic eq

2005-08-24 Thread Damian Conway
Larry wrote: Or we could have a different operator that coerces like == and eq, only via .snap: if [1,2,3] equals [1,2,3] { say true } else { say false } (Actual name negotiable, of course). The advantage of the latter approach is that you can say @foo equals @bar and the

Re: ~ and + vs. generic eq

2005-08-24 Thread Yuval Kogman
On Tue, Aug 23, 2005 at 16:32:37 -0700, Larry Wall wrote: Hmm, well, I don't think op is valid syntax, but you did say semantics, so I can't criticize that part. :-) What is , btw? Is it circumfix:{'',''} (Code op -- Code); # takes some code, returns a listop or

~ and + vs. generic eq

2005-08-23 Thread Yuval Kogman
I don't like eqv, because it's ugly, inconsistent with anything else in Perl 6, especially , ||, and ^^. It might be forced to fit into the and, or, and xor family, but you'd expect to find 'eq' there, and that's not what it means. IMHO == is as generic as and ||, and is even more like ^^ since

Re: ~ and + vs. generic eq

2005-08-23 Thread Ingo Blechschmidt
Hi, Yuval Kogman wrote: I think this is more consistent, and just as useful: 10 == 10; # dispatches to num 10 == 10; # dispatched to Num, by means of coercion (== has some affinity to it for backwards compatibility) 10 == 10; # dispatches to Str, due to better match 10.0 == 10; # unlike

Re: ~ and + vs. generic eq

2005-08-23 Thread Yuval Kogman
On Tue, Aug 23, 2005 at 18:15:07 +0200, Ingo Blechschmidt wrote: sorry, I've some problems with this proposal: == has always meant numeric equality in Perl and I'd like it to stay that way. For simple values like numbers and strings == is numberic, because it's affinity to it. snip 10 ==

Re: ~ and + vs. generic eq

2005-08-23 Thread Larry Wall
On Tue, Aug 23, 2005 at 06:19:33PM +0300, Yuval Kogman wrote: : 10 == 10; # dispatches to Str, due to better match Nope, that will continue to coerce to numeric comparison. The design team did in fact consider pure equivalence MMD dispatch of == in the last meeting, but rejected it in

Re: ~ and + vs. generic eq

2005-08-23 Thread Yuval Kogman
On Tue, Aug 23, 2005 at 10:28:01 -0700, Larry Wall wrote: On Tue, Aug 23, 2005 at 06:19:33PM +0300, Yuval Kogman wrote: : 10 == 10; # dispatches to Str, due to better match Nope, that will continue to coerce to numeric comparison. The design team did in fact consider pure equivalence

Re: ~ and + vs. generic eq

2005-08-23 Thread Larry Wall
On Wed, Aug 24, 2005 at 12:43:46AM +0300, Yuval Kogman wrote: : On Tue, Aug 23, 2005 at 10:28:01 -0700, Larry Wall wrote: : On Tue, Aug 23, 2005 at 06:19:33PM +0300, Yuval Kogman wrote: : : 10 == 10; # dispatches to Str, due to better match : : Nope, that will continue to coerce to numeric