[perl #36641] [TODO] Data::Dumper does hash, etc.

1 view
Skip to first unread message

Will Coleda

unread,
Jul 23, 2005, 5:14:16 PM7/23/05
to bugs-bi...@rt.perl.org
# New Ticket Created by Will Coleda
# Please include the string: [perl #36641]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36641 >


It would be nice if, rather than the various "pmcPerlHash" and
"pmcPerlArray" variants that exist, if there was a simple check to
see if the pmc in question did hash or did array - if so, then use
the default method for dumping hashes and arrays.

With a check first to see if the pmc/object that was passed
implemented a "dump" method.

This would allow generic HLL PMCs to automagically be dumped with
sane defaults.

Leopold Toetsch

unread,
Jul 23, 2005, 6:31:35 PM7/23/05
to perl6-i...@perl.org, bugs-bi...@netlabs.develooper.com

On Jul 23, 2005, at 23:14, Will Coleda (via RT) wrote:

>
> With a check first to see if the pmc/object that was passed
> implemented a "dump" method.

The opcode C<does> does exist, as well as interface names like 'hash'
or 'array'.

new P0, .Hash
does I0, P0, 'hash'
print I0

See also

perldoc build_tools/pmc2c.pl
/does

leo

Will Coleda via RT

unread,
Oct 8, 2005, 9:37:43 PM10/8/05
to perl6-i...@perl.org
Data::Dumper now checks to see if a special case for a particular PMC is implemented, and if
not, the code falls back to a generic implementation for each of array, hash, string, integer,
and float.

Added in string, integer, and float does types to pmc2c.pl and the various core/perl types
that implement them.

Removed all the specific implementations that dispatched to a generic implementation, or
simply duplicated the functionality provided by "pmcDefault".

Avoid most upcoming deprecation warnings in these library routines.

Removed internal usage of Perl PMCs for these library routines.

All tests pass. (rechecked everything since I mucked with the basic PMC types to enable the
new 'does' variants.)

> [coke - Sat Jul 23 14:14:15 2005]:


>
> It would be nice if, rather than the various "pmcPerlHash" and
> "pmcPerlArray" variants that exist, if there was a simple check to
> see if the pmc in question did hash or did array - if so, then use
> the default method for dumping hashes and arrays.
>

> With a check first to see if the pmc/object that was passed
> implemented a "dump" method.
>

Reply all
Reply to author
Forward
0 new messages