I have responded to the ticket,
http://rt.perl.org/rt3/index.html?q=31859, but the response hasn't made
if to perl6-i...@perl.org.
Is there a policy, which responses to RT tickets are posted to
perl6-i...@perl.org? I know that it works fine for new tickets.
A patch for moving the implementation of the PerlHash PMC to the new
Hash PMC is attached to the ticket 31859. The description is also pasted
below.
----------------
Pasted from http://rt.perl.org/rt3/index.html?q=31859:
The PerlHash is now an extension of Hash.
The semantics should not have changed. For example, integer values are
still stored as PerlInt PMCs in the Hash PMC.
During testing I got confused over the combination
"KEY_integer_FLAG|KEY_number_FLAG", which indicates a key in a hash
iterator. For that combination I have introduced KEY_hash_iterator_FLAGS
in 'include/parrot/key.h'.
Summary of the changes in the attached patch:
- Hash PMC is new
- PerlHash PMC extends Hash PMC
- t/pmc/hash.t is new, basically a copy of t/pmc/perlhash.t
- The OrderedHash PMC now uses the Hash PMC
- Added Support for Hash PMC in 'Data/Dumper/Default.imc'
- The dynamic PMC Match now extends the Hash PMC
- The various hashes in the Parrot core are now Hash PMCs
At least on my machine,
Linux linux 2.4.20-4GB-athlon #1 Mon Mar 17 17:56:47 UTC 2003 i686
unknown unknown GNU/Linux,
the standard test are all passing.
I don't know wether the tests in 'language/perl6' should be passing.
When I try to run them, I get:
t/builtins/array...........# Failed test (t/builtins/array.t at line 7)
# got: 'error:imcc:undefined identifier '_die'
#
# in file
'/home/bernhard/devel/Parrot/parrot/languages/perl6/t/builtins/array_1.pasm'
line 634
TODO:
- Get rid of Perl* PMCs in Hash PMC
- Move Perl6 specific behavior back to the PerlHash PMC.
- The NCI method has an implementation in Hash and in PerlHash, this is
not nice
CU, Bernhard
--
**************************************************
Dipl.-Physiker Bernhard Schmalhofer
Senior Developer
Biomax Informatics AG
Lochhamer Str. 11
82152 Martinsried, Germany
Tel: +49 89 895574-839
Fax: +49 89 895574-825
eMail: Bernhard.S...@biomax.com
Website: www.biomax.com
**************************************************
> The PerlHash is now an extension of Hash.
Great, thanks.
> The semantics should not have changed. For example, integer values are
> still stored as PerlInt PMCs in the Hash PMC.
I'd propose the following:
* instead of PerlInt an Integer PMC is stored
* Float, String the same
* eventually we should have a table of such basic types per language
and automatically store the Perl/Py/Tcl/...Integer of the language
we are currently running. This would allow for better code sharing
* get_pmc_keyed (and friends) of Hash returns NULL on failure - this is
the desired usage inside Parrot anyway
* a PerlHash can then return a PerlUndef after calling SUPER()
> During testing I got confused over the combination
> "KEY_integer_FLAG|KEY_number_FLAG", which indicates a key in a hash
> iterator. For that combination I have introduced KEY_hash_iterator_FLAGS
> in 'include/parrot/key.h'.
Good.
> TODO:
> - Get rid of Perl* PMCs in Hash PMC
> - Move Perl6 specific behavior back to the PerlHash PMC.
> - The NCI method has an implementation in Hash and in PerlHash, this is
> not nice
The NCI method is automatically inherited from Hash. But as it's a
python method it'll be removed from Hash anyway.
> CU, Bernhard
Thanks, applied.
leo
>>- The NCI method has an implementation in Hash and in PerlHash, this is
>>not nice
>
> The NCI method is automatically inherited from Hash. But as it's a
> python method it'll be removed from Hash anyway.
Any objections to the NCI methods being removed from Coroutine(next),
Hash(fromkeys), Iterator(next), and PerlHash(fromkeys) now?
- Sam Ruby
The fromkeys in Hash and PerlHash can be removed. The .next methods in
iterable PMCs will be needed generally. But iterators need some rework
still, especially Python generator functions.
> - Sam Ruby
leo