Skip to content

runtime: add weak.Pointer.Value compatibility shim - #5714

Merged
deadprogram merged 1 commit into
tinygo-org:devfrom
jakebailey:runtime-weak-pointer
Sep 22, 2026
Merged

deadprogram merged 1 commit into
tinygo-org:devfrom
jakebailey:runtime-weak-pointer

Conversation

@jakebailey

@jakebailey jakebailey commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

This allows more of the reflect package to work. (Part of a big stack I'm working on)

The reverse of registerWeakPointer.

Probably full weak pointer support is possible with some GCs but that's out of scope for this fix.

Fixes #5693

@jakebailey

Copy link
Copy Markdown
Member Author

Ah, there is already #5698, but it adds a test that shouldn't be required (other tests in the repo can catch this), and did not correctly cross ref the issue for closing, so I did not notice.

TinyGo currently keeps the original pointer strongly reachable when a weak
pointer is registered. Add the matching conversion hook so
weak.Pointer.Value links while retaining the existing no-op semantics.

@deadprogram deadprogram left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor nits, but probably not worth mentioning. Thank you @jakebailey

@deadprogram
deadprogram merged commit 250ea53 into tinygo-org:dev Sep 22, 2026
33 checks passed
@jakebailey
jakebailey deleted the runtime-weak-pointer branch September 22, 2026 16:01
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.

runtime: weak.Pointer.Value fails to link

2 participants