On Wed, 09 Aug 2000 12:46:32 -0400, Dan Sugalski wrote:
>> > @foo = @bar * @baz;
>Given that the default action of the multiply routine for an array in
>non-scalar context would be to die, allowing user-overrides of the
>functions would probably be a good idea... :)
[Is this still -internals? Or should we stop CC'ing?]
One problem: overloading requires objects, or at least one. Objects are
(currently) scalars. You can't make an array into an object.
Well, you can try:
bless \@ary, 'Vector';
print ref \@ary;
which says:
Vector
so you COULD get there in the end. A nicer syntax would be along the
proposed syntax of
my Vector @ary;
but a problem is:
@copy = @ary;
which only copies the items by value, as a list, and thus ignores the
blessing. @copy is a plain array.
--
Bart.