HaloO Ingo,
you wrote:
according to Damian [1]...:
my %hash = (a => 1, b => 2);
my @array = %hash;
say @array[0].isa(Pair); # true
How can I override this behaviour?
class MyHash is Hash {
# Please fill in here
# my idea is to overload &*infix:<=>
multi method infix:{'='} ( Array @a, MyHash +%h )
{
# your stuff here ...
# in particular you have access to your private attrs
# and methods
}
}
my %hash is MyHash = (a => 1, b => 2);
my @array = %hash; # should call my own routine
I hope the initialisation in my also calls the overloaded
operator. But why shouldn't it?
--
TSa (Thomas Sandlaß)