On Sun, 22 Aug 2021 at 05:40, Ed Avis <ed.avis@qmaw.com> wrote: > Tony Cook wrote: > > >In addition to Nicholas's response, when objects are duplicated into a > >new thread the duplicated object has a new address which breaks > >the hash, and finding the object given the address. > > But that's equally true with the way hashing works currently. The address > changes, so the string representation changes, so you can no longer look up > with the same key. > > % perl -Mthreads -le 'my $x = bless {}; $h{$x} = "hello"; print $h{$x}; > threads->create(sub { print $h{$x} // "undef" })->join' > hello > undef > > So while it's a reminder to be careful about object identity when you are > using threads, it's not a point of difference between stringifying hash > keys and hashing by address. > It is a demonstration that we dont have a well defined object identity function and that having one would be useful. :-) yvesThread Previous | Thread Next