Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Data-Printer CPAN distribution.

Report information
The Basics
Id: 86630
Status: rejected
Priority: 0/
Queue: Data-Printer

People
Owner: Nobody in particular
Requestors: daxim [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.35
Fixed in: (no value)



Subject: remove prototypes
p() uses prototypes. Having used this in Devel::REPL exclusively for over about two years now, I'm well sick of this misfeature and its jarring admonishments that go against the flow of work. No work day passes that I don't see one of those: Type of arg 1 to Data::Printer::p must be one of [@$%&] (not null operation) Type of arg 1 to Data::Printer::p must be one of [@$%&] (not anonymous list ([])) When calling p() without prototypes, please pass arguments as reference In my opinion prototype coercion greatly diminishes the usability and usefulness of DDP. Usefulness: it does not accept arbitrary expressions, e.g. C<'a'..'e'>. Some - not all - of them can be rectified with by configuring C<< use_prototypes => 0 >>, so out of the box DDP has not optimal defaults. I have to take great care to carry the configuration file around to every host I want to program and debug. Usability: when I paste in expressions, I have to be careful to wrap them in the appropriate reference constructor. Sometimes this requires a stopover in the text editor. Then I have to interpret the result and take in to account that I'm seeing an extra level of reference. I propose for p() to accept arbitrary expressions, just like DDS::DumpLex() or any other dumper. This affects the "local configuration" feature, which changes accordingly: if the last list element is a hashref and all its keys look like DDP options, then it is removed from the list of items to be pretty-printed and accepted as local options. This heuristic is the default behaviour, but can be disabled via configuration, so that the last item is pretty-printed no matter what. That should cover all existing use cases. A side effect of p() would be that lists are then pretty-printed with parentheses: ( [0] "a", [1] "b", [2] "c", [3] "d", [4] "e" )
Hi there! I'm really sorry prototypes have been such a burden for you. How about providing Devel::REPL (or maybe even Data::Printer itself) with an alternative function that will behave just like you want? I've been thinking about this for quite some time now (on a related note, sorry for taking so long to reply to this) and though there are currently many tips on how to circumvent prototypes, a simple "dump whatever is inside" function could go a long way. I'm marking the issue as rejected here on RT because we've moved the issue tracker to Github. But hopefully we'll be able to come up with a solution for this pretty soon! Thanks again, garu On Tue Jul 02 07:35:17 2013, DAXIM wrote: Show quoted text
> p() uses prototypes. Having used this in Devel::REPL exclusively for > over about two years now, I'm well sick of this misfeature and its > jarring admonishments that go against the flow of work. No work day > passes that I don't see one of those: > > Type of arg 1 to Data::Printer::p must be one of [@$%&] (not null > operation) > Type of arg 1 to Data::Printer::p must be one of [@$%&] (not anonymous > list ([])) > When calling p() without prototypes, please pass arguments as > reference > > In my opinion prototype coercion greatly diminishes the usability and > usefulness of DDP. > > Usefulness: it does not accept arbitrary expressions, e.g. > C<'a'..'e'>. > > Some - not all - of them can be rectified with by configuring C<< > use_prototypes => 0 >>, so out of the box DDP has not optimal > defaults. I have to take great care to carry the configuration file > around to every host I want to program and debug. > > Usability: when I paste in expressions, I have to be careful to wrap > them in the appropriate reference constructor. Sometimes this requires > a stopover in the text editor. Then I have to interpret the result and > take in to account that I'm seeing an extra level of reference. > > I propose for p() to accept arbitrary expressions, just like > DDS::DumpLex() or any other dumper. This affects the "local > configuration" feature, which changes accordingly: if the last list > element is a hashref and all its keys look like DDP options, then it > is removed from the list of items to be pretty-printed and accepted as > local options. This heuristic is the default behaviour, but can be > disabled via configuration, so that the last item is pretty-printed no > matter what. That should cover all existing use cases. > > A side effect of p() would be that lists are then pretty-printed with > parentheses: > > ( > [0] "a", > [1] "b", > [2] "c", > [3] "d", > [4] "e" > )