<commit_before>my role X::Comp { ... }
my class X::ControlFlow { ... }

my class Exception {
    has $!ex;
    has $!bt;

    method backtrace(Exception:D:) {
        if $!bt { $!bt }
        elsif nqp::isconcrete($!ex) {
            nqp::bindattr(self, Exception, '$!bt', Backtrace.new($!ex));
        }
        else { '' }
    }

    # Only valid if .backtrace has not been called yet
    method vault-backtrace(Exception:D:) {
        nqp::isconcrete($!ex) && $!bt ?? Backtrace.new($!ex) !! ''
    }
    method reset-backtrace(Exception:D:) {
        nqp::bindattr(self, Exception, '$!ex', Nil)
    }

    multi method Str(Exception:D:) {
        my $str;
        if nqp::isconcrete($!ex) {
            my str $message = nqp::getmessage($!ex);
            $str = nqp::isnull_s($message) ?? '' !! nqp::p6box_s($message);
        }
        $str ||= (try self.?message);
        $str = ~$str if defined $str;
        $str // "Something went wrong in {self.WHAT.gist}";
    }

    multi method gist(Exception:D:) {
        my $str;
        if nqp::isconcrete($!ex) {
            my str $message = nqp::getmessage($!ex);
            $str = nqp::isnull_s($message)
                ?? "Died with {self.^name}"
                !! nqp::p6box_s($message);
            $str ~= "\n";
            try $str ~= self.backtrace
              || Backtrace.new()
              || '  (no backtrace available)';
        }
        else {
            $str = (try self.?message) // "Unthrown {self.^name} with no message";
        }
        $str;
    }

    method throw(Exception:D: $bt?) {
        nqp::bindattr(self, Exception, '$!ex', nqp::newexception())
            unless nqp::isconcrete($!ex) and $bt;
        nqp::bindattr(self, Exception, '$!bt', $bt); # Even if !$bt
        nqp::setpayload($!ex, nqp::decont(self));
        my $msg := try self.?message;
        if defined($msg) {
            $msg := try ~$msg;
        }
        $msg := $msg // "{self.^name} exception produced no message";
        nqp::setmessage($!ex, nqp::unbox_s($msg));
        nqp::throw($!ex)
    }
    method rethrow(Exception:D:) {
        nqp::bindattr(self, Exception, '$!ex', nqp::newexception())
            unless nqp::isconcrete($!ex);
        nqp::setpayload($!ex, nqp::decont(self));
        nqp::rethrow($!ex)
    }

    method resumable(Exception:D:) {
        nqp::p6bool(nqp::istrue(nqp::atkey($!ex, 'resume')));<commit_msg>Convert some bindattrs to direct binding<commit_after>my role X::Comp { ... }
my class X::ControlFlow { ... }

my class Exception {
    has $!ex;
    has $!bt;

    method backtrace(Exception:D:) {
        if $!bt { $!bt }
        elsif nqp::isconcrete($!ex) {
            $!bt := Backtrace.new($!ex);
        }
        else { '' }
    }

    # Only valid if .backtrace has not been called yet
    method vault-backtrace(Exception:D:) {
        nqp::isconcrete($!ex) && $!bt ?? Backtrace.new($!ex) !! ''
    }
    method reset-backtrace(Exception:D:) {
        $!ex := Nil
    }

    multi method Str(Exception:D:) {
        my $str;
        if nqp::isconcrete($!ex) {
            my str $message = nqp::getmessage($!ex);
            $str = nqp::isnull_s($message) ?? '' !! nqp::p6box_s($message);
        }
        $str ||= (try self.?message);
        $str = ~$str if defined $str;
        $str // "Something went wrong in {self.WHAT.gist}";
    }

    multi method gist(Exception:D:) {
        my $str;
        if nqp::isconcrete($!ex) {
            my str $message = nqp::getmessage($!ex);
            $str = nqp::isnull_s($message)
                ?? "Died with {self.^name}"
                !! nqp::p6box_s($message);
            $str ~= "\n";
            try $str ~= self.backtrace
              || Backtrace.new()
              || '  (no backtrace available)';
        }
        else {
            $str = (try self.?message) // "Unthrown {self.^name} with no message";
        }
        $str;
    }

    method throw(Exception:D: $bt?) {
        $!ex := nqp::newexception() unless nqp::isconcrete($!ex) and $bt;
        $!bt := $bt; # Even if !$bt
        nqp::setpayload($!ex, nqp::decont(self));
        my $msg := try self.?message;
        if defined($msg) {
            $msg := try ~$msg;
        }
        $msg := $msg // "{self.^name} exception produced no message";
        nqp::setmessage($!ex, nqp::unbox_s($msg));
        nqp::throw($!ex)
    }
    method rethrow(Exception:D:) {
        $!ex := nqp::newexception() unless nqp::isconcrete($!ex);
        nqp::setpayload($!ex, nqp::decont(self));
        nqp::rethrow($!ex)
    }

    method resumable(Exception:D:) {
        nqp::p6bool(nqp::istrue(nqp::atkey($!ex, 'resume')));
{'fraction_non_alphanumeric': 0.18555149430230058, 'fraction_numerical': 0.0012900451515803052, 'mean_word_length': 2.042511445389143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6848791', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1581, 'n_words': 320}