<commit_before>my class Exception { ... }

my class Backtrace { ... }

my class Backtrace::Frame {
    has Str $.file;
    has Int $.line;
    has Mu  $.code;
    has Str $.subname;

    method subtype(Backtrace::Frame:D:) {
        my $s = $!code.^name.lc.split('+', 2)[0];
        $s eq 'mu' ?? '' !! $s;
    }

    method package(Backtrace::Frame:D:) {
        $.code.package;
    }

    multi method Str(Backtrace::Frame:D:) {
        my $s = self.subtype;
        $s ~= ' ' if $s.chars;
        "  in {$s}$.subname at {$.file}:$.line\n"
    }

    method is-hidden(Backtrace::Frame:D:)  { $!code.?is_hidden_from_backtrace }
    method is-routine(Backtrace::Frame:D:) { $!code ~~ Routine }
    method is-setting(Backtrace::Frame:D:) { $!file eq 'src/gen/CORE.setting' }
}

my class Backtrace is List {
    proto method new(|) {*}

    multi method new(Exception $e, Int $offset = 0) {
#?if parrot<commit_msg>Fix classification of errors as coming from the setting<commit_after>my class Exception { ... }

my class Backtrace { ... }

my class Backtrace::Frame {
    has Str $.file;
    has Int $.line;
    has Mu  $.code;
    has Str $.subname;

    method subtype(Backtrace::Frame:D:) {
        my $s = $!code.^name.lc.split('+', 2)[0];
        $s eq 'mu' ?? '' !! $s;
    }

    method package(Backtrace::Frame:D:) {
        $.code.package;
    }

    multi method Str(Backtrace::Frame:D:) {
        my $s = self.subtype;
        $s ~= ' ' if $s.chars;
        "  in {$s}$.subname at {$.file}:$.line\n"
    }

    method is-hidden(Backtrace::Frame:D:)  { $!code.?is_hidden_from_backtrace }
    method is-routine(Backtrace::Frame:D:) { $!code ~~ Routine }
    method is-setting(Backtrace::Frame:D:) {
        $!file.chars > 12 && $!file.substr(*-12) eq 'CORE.setting'
    }
}

my class Backtrace is List {
    proto method new(|) {*}

    multi method new(Exception $e, Int $offset = 0) {
#?if parrot
{'fraction_non_alphanumeric': 0.18329831932773108, 'fraction_numerical': 0.005252100840336135, 'mean_word_length': 2.54089219330855, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5286432', 'n_tokens_mistral': 702, 'n_tokens_neox': 672, 'n_words': 161}