Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slips are not handled correctly #54

Closed
lizmat opened this issue May 23, 2019 · 7 comments
Closed

Slips are not handled correctly #54

lizmat opened this issue May 23, 2019 · 7 comments

Comments

@lizmat
Copy link

lizmat commented May 23, 2019

$ perl6 -e 'use Data::Dump::Tree; ddt (1,2,3).Slip'
1
@nkh
Copy link
Owner

nkh commented May 25, 2019

Implemented as a special case by wrapping Slips in Data::Dump::Tree::Type::SlipWrapper, Another attempt, handling the Slip as an object as long as possible before passing it in a list, had too large an impact on the code base.

@nkh nkh closed this as completed May 25, 2019
@lizmat
Copy link
Author

lizmat commented May 25, 2019

FWIW, Slips need special handling throughout the Rakudo code base to give them their magical properties.

@nkh
Copy link
Owner

nkh commented May 25, 2019

It made me crazy, once I got it to display properly I found it that the changes broke everything else, I didn't have enough tests to find the errors, running the examples in the distribution, which unfortunately don't all have corresponding tests, showed that even making a diff between two data structures was broken (my favorite part of DDT).

10 lines to handle Slip, and everything works like before, not sure if a hack like that shouldn't be called the best solution.

Thank you for reporting it, maybe ;), I am not sure how many people need to render Slips.

@lizmat
Copy link
Author

lizmat commented May 25, 2019

I needed it because I have a large array of arrays and hashes and wanted a cheap way of making it object oriented. So I have a role that you just like the keys, and it will automatically create methods for that accessing that key in the hash (very much like standard Perl 5 objects). The problem was with the arrays, because they got itemized. This meant you couldn't do for $obj.array", because it wouldn't iterate. But it *does* if you bind the key to a Slip` :-) Which is a bit of a hack, but it works really nicely and smoothly :-)

@nkh
Copy link
Owner

nkh commented May 25, 2019

An example of the data structure, what you wanted to do with it and how the Slips where used would make a nice technical article for many I think.

@lizmat
Copy link
Author

lizmat commented May 25, 2019

The thought has crossed my mind

@nkh
Copy link
Owner

nkh commented May 26, 2019

If you write an article, I need to see more of P6 usage, and do dumps with DDT, let me know if you want some help with filters if the wrap_highlight example is not enough, or a review.

for presentation, and quite often for oneself too, :flat(0) can give a nicer/more usable display, even if it is slooooow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants