From 973638c0e8e1fd34134d7509f5dfef5088efc171 Mon Sep 17 00:00:00 2001 From: Nick Logan Date: Sat, 16 May 2026 10:15:08 -0700 Subject: [PATCH] Fix loaded-symbol check for the staging-repo class (try ::($name)) was always False for any loaded class: ::($name) returns the class's type object when bound, type objects coerce to False in Boolean context, and the try wraps a missing-symbol Failure into Any (also False). So the `?? ::($name).new ...` branch never ran; the `!! do { ... $core-repo.resolve(...).distribution ... }` fallback took every call. Drop the try. Bare ::($name) returns the type object when the symbol is bound and a Failure when it is not, so `!~~ Failure` distinguishes them and the fast path can be reached when the class is already loaded (which is always the case once CompUnit::Repository::Staging moves into CORE.setting). --- lib/Zef/Client.rakumod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Zef/Client.rakumod b/lib/Zef/Client.rakumod index 508d28d2..41ad3c27 100644 --- a/lib/Zef/Client.rakumod +++ b/lib/Zef/Client.rakumod @@ -1076,7 +1076,7 @@ class Zef::Client { # for instance). my %curfs-new-args = :prefix($staging-at), :name($stage-for-repo.name), :next-repo($stage-for-repo); my $curfs-short-name = 'CompUnit::Repository::Staging'; - (try ::($curfs-short-name)) + (::($curfs-short-name) !~~ Failure) ?? ::($curfs-short-name).new(|%curfs-new-args) !! do { # Find CURS from the core repository so we can load it by path later