logo       

hash multithreading and cross language issue: msg#00578

lang.perl.perl6.internals

Subject: hash multithreading and cross language issue

I note that the perlscalar code is careful about multithreading issues (example: "if we morph to a string, first clear str_val so that after changing the vtable a parallel reader doesn't get a gargabe pointer"), but reuses a static PMC* intret.

The current PerlHash PMC coerces keys to strings, so the following will print bar:

my %hash;
$hash{1} = 'foo';
$hash{"1"} = 'bar';
print $hash{1};

Whereas the nearest equivalent in Python will print foo:

dict = {}
dict[1] = 'foo'
dict["1"] = 'bar'
print dict[1]

For Python support, it would be ideal if there would be a hash method entry in the VTABLE for each object.

- Sam Ruby



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise