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

Backtrace.map is dead code #5689

Closed
p6rt opened this issue Sep 23, 2016 · 5 comments
Closed

Backtrace.map is dead code #5689

p6rt opened this issue Sep 23, 2016 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Sep 23, 2016

Migrated from rt.perl.org#129334 (status was 'resolved')

Searchable as RT129334$

@p6rt
Copy link
Author

p6rt commented Sep 23, 2016

From @zoffixznet

This .map multi in Backtrace.pm never gets acccessed​: https://github.com/rakudo/rakudo/blob/553cedb679f0f191d2f7341e05033505cb20ac7a/src/core/Backtrace.pm#L282

  <Zoffix> m​: Backtrace.new.map​: {...}
  <camelia> rakudo-moar 553ced​: OUTPUT«Ambiguous call to 'map'; these signatures all match​:␤​:(\SELF​: █; :$label, :$item, *%_)␤​:(Backtrace​:D $​: $block, *%_)␤ in block <unit> at <tmp> line 1␤␤»

It seems like merely changing $block to &block in the signature would fix the issue, but I'm unsure whether :$label and :$item need to be added to it as well.

Mentioned on IRC as well​: http://irclog.perlgeek.de/perl6-dev/2016-09-22#i_13260484

@p6rt
Copy link
Author

p6rt commented Sep 23, 2016

From @lizmat

AFAIK, :$label en :$item are internal to the setting. They’re needed because internally, map is used for for-loops. And for loops can have a label. And need to be told the list they’re getting should be considered an item.

Regarding why .first and .map exist​: this is because of the way a backtrace is not really a List, but pretends to be. The .list method vivifies 100 elements (if it can), which basically means that the whole backtrace gets vivified to find e.g. the first non-core setting line. Which is expensive.

I think the whole backtrace handling needs to be rethought at some point in time, and probably rewritten from scratch, because at the moment it is a pile of hacks on hacks on hacks. :-(

So I’ve made it a &block, as you suggested.

Closable with tests, I would say :-)

On 23 Sep 2016, at 02​:01, Zoffix Znet (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Zoffix Znet
# Please include the string​: [perl #​129334]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=129334 >

This .map multi in Backtrace.pm never gets acccessed​: https://github.com/rakudo/rakudo/blob/553cedb679f0f191d2f7341e05033505cb20ac7a/src/core/Backtrace.pm#L282

<Zoffix> m​: Backtrace.new.map​: {...}
<camelia> rakudo-moar 553ced​: OUTPUT«Ambiguous call to 'map'; these signatures all match​:␤​:(\SELF​: █; :$label, :$item, *%_)␤​:(Backtrace​:D $​: $block, *%_)␤ in block <unit> at <tmp> line 1␤␤»

It seems like merely changing $block to &block in the signature would fix the issue, but I'm unsure whether :$label and :$item need to be added to it as well.

Mentioned on IRC as well​: http://irclog.perlgeek.de/perl6-dev/2016-09-22#i_13260484

@p6rt
Copy link
Author

p6rt commented Sep 23, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 23, 2016

From @zoffixznet

Tests added in Raku/roast@e5bd8d8c54

@p6rt
Copy link
Author

p6rt commented Sep 23, 2016

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Sep 23, 2016
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

1 participant