develooper Front page | | Postings from September 2000

Re: logical ops on arrays and hashes

Thread Previous
Dan Sugalski
September 13, 2000 13:30
Re: logical ops on arrays and hashes
Message ID:
At 09:49 AM 9/13/00 +1200, Christian Soeller wrote:
>It's probably just me but I thought (1) just creating an object leaves
>me handing around scalars

That's likely not to be the case in p6. You should be able to overload the 
operations for arrays and hashes, and ought to be able to do objectish 
things with them. (Though they may not actually be 'objects' in the full 
perl sense)

>  (2) tie doesn't let me modify those
>polymorphic methods (or does it? and what's the syntax with multi-dims
>anyway), so there. What I might want to do is overload ADD for a
>multi-dim array @a. How would I go about it while preserving the array

Just overload the array. Your ADD (or whatever it gets called) method will 
be called when you do math with your overloaded array.


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai                         have teddy bears and even
                                      teddy bears get drunk

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About