Re: RFC 82 (v3) Arrays: Apply operators element-wise in a list context
[email protected] (Nathan Wiger) Sat, 09 Sep 2000 13:24:57 -0700
| Newsgroups | perl.perl6.language.data |
|---|---|
| Message-ID | <[email protected]> |
[email protected] wrote: > > I disagree. You end up with a situation where some > > @a * @b; > > are in scalar context, some not. No, everything would be in a scalar context. If you used tie() to specially tie a variable, then you might be able to overload +, *, -, etc, but this is no different from overloading other objects, which you can do currently. > And what happens when you say > > @a = (1,2,2); > @b = tie Matrix (1,2,3); > > @a*@b; > > Who wins? There are already well-established precedence rules on operator overloading; check out the Camel-3 chapter on it. The methods proposed in RFC 159 would follow these same rules, although this should probably be explicitly stated in the RFC. -Nate