Skip to content

Add IoContext::tryCurrent()#5676

Merged
jasnell merged 1 commit intomainfrom
jasnell/simplify-iocontext-boilerplate
Dec 11, 2025
Merged

Add IoContext::tryCurrent()#5676
jasnell merged 1 commit intomainfrom
jasnell/simplify-iocontext-boilerplate

Conversation

@jasnell
Copy link
Copy Markdown
Collaborator

@jasnell jasnell commented Dec 11, 2025

A common pattern throughout the codebase is to check if there is a current IoContext via IoContext::hasCurrent() before calling IoContext::current(). This change introduces IoContext::tryCurrent() which returns a Maybe<IoContext&> to simplify this pattern and eliminate and remove redundant checks that are redundantly redundant.

A common pattern throughout the codebase is to check if there
is a current IoContext via IoContext::hasCurrent() before
calling IoContext::current(). This change introduces
IoContext::tryCurrent() which returns a Maybe<IoContext&>
to simplify this pattern and eliminate and remove redundant
checks that are redundantly redundant.
@jasnell jasnell added the technical debt Label used for changes that address technical debt label Dec 11, 2025
@jasnell jasnell requested review from a team as code owners December 11, 2025 01:12
@jasnell jasnell merged commit 55f2972 into main Dec 11, 2025
33 of 35 checks passed
@jasnell jasnell deleted the jasnell/simplify-iocontext-boilerplate branch December 11, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

technical debt Label used for changes that address technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants