Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RT#31859, Plain ole Hash

10 views
Skip to first unread message

Bernhard Schmalhofer

unread,
Dec 13, 2004, 7:36:05 AM12/13/04
to perl6-i...@perl.org
Hi,

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
**************************************************

Leopold Toetsch

unread,
Dec 13, 2004, 8:46:09 AM12/13/04
to Bernhard Schmalhofer, perl6-i...@perl.org
Bernhard Schmalhofer <Bernhard.S...@biomax.de> wrote:
> Hi,

> 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

Sam Ruby

unread,
Dec 17, 2004, 5:42:22 PM12/17/04
to l...@toetsch.at, perl6-i...@perl.org
Leopold Toetsch wrote:

>>- 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

Leopold Toetsch

unread,
Dec 18, 2004, 3:11:35 AM12/18/04
to Sam Ruby, perl6-i...@perl.org
Sam Ruby wrote:
>
> Any objections to the NCI methods being removed from Coroutine(next),
> Hash(fromkeys), Iterator(next), and PerlHash(fromkeys) now?

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

0 new messages