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.
- Re: PDL-P: Re: Hooks for array notation (was Re: Ramblin... Dan Sugalski
- Re: PDL-P: Re: Hooks for array notation (was Re: Ramblin... Karl Glazebrook
- Re: PDL-P: Re: Hooks for array notation (was Re: Ramblin... Dan Sugalski
- Re: PDL-P: Re: Hooks for array notation (was Re:Rambling... Karl Glazebrook
- sorted sparse containers (was Re: PDL-P: Re: Hooks for a... David L. Nicol
- Re: sorted sparse containers (was Re: PDL-P: Re: Hooks f... Bryan C . Warnock
- Re: sorted sparse containers (was Re: PDL-P: Re: Hooks f... Dan Sugalski
- Re: Ramblings on "base class" for SV etc. Dan Sugalski
- vector and matrix calculations in core? (was: Re: Rambli... Bart Lateur
- Re: vector and matrix calculations in core? (was: Re: Ra... Dan Sugalski
- Re: vector and matrix calculations in core? (was: Re: Ra... Bart Lateur
- Re: vector and matrix calculations in core? (was: Re: Ra... Nick Ing-Simmons
- Re: Ramblings on "base class" for SV etc. Bryan C . Warnock
- Re: Ramblings on "base class" for SV etc. Dan Sugalski
- Method call optimization. Nick Ing-Simmons
- Re: Method call optimization. Chaim Frenkel
- Re: Method call optimization. Dan Sugalski
- Re: Method call optimization. Joshua N Pritikin
- Re: Method call optimization. Dan Sugalski
- Re: Method call optimization. Graham Barr
- Re: Method call optimization. Chaim Frenkel
