Skip to content

Fix loaded-symbol check for the staging-repo class#617

Merged
ugexe merged 1 commit into
mainfrom
ugexe/fix-curs
May 24, 2026
Merged

Fix loaded-symbol check for the staging-repo class#617
ugexe merged 1 commit into
mainfrom
ugexe/fix-curs

Conversation

@ugexe

@ugexe ugexe commented May 16, 2026

Copy link
Copy Markdown
Owner

(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/if CompUnit::Repository::Staging moves into CORE.setting).

(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).
@ugexe ugexe merged commit 76162df into main May 24, 2026
6 checks passed
ugexe added a commit that referenced this pull request May 24, 2026
The `!~~ Failure` check in #617 distinguishes loaded vs missing
symbol, but smartmatch doesn't mark the Failure handled, so DESTROY
warns about the unhandled missing-symbol Failure on every install
when the class isn't loaded (i.e. every install today).

Restructure as `do given` with a `when Failure` arm so the Failure
is dispatched on as a topic and marked handled inside the load-by-path
fallback.
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

Successfully merging this pull request may close these issues.

1 participant