Skip to content

Conversation

@ysbaddaden
Copy link
Contributor

As discussed in RFC 2 and in light of #15871 for example, the execution contexts are much more about "how fibers run", either concurrently or in parallel or by themselves (the intent), and have little to do with "threads" that are only the technical mean to achieve parallelism.

A great example is that the isolated context doesn't have the word thread in its name, despite being the only context that guarantees the fiber will always run on the same thread (the fiber owns the thread until it terminates).

This PR renames:

  • SingleThreaded to Concurrent
  • MultiThreaded to Parallel

It also refines the documentation of the different types to also insist on the intent, what it means, and what are the actual guarantees given by each context.

Co-authored-by: Johannes Müller <[email protected]>
Co-authored-by: sbsoftware <[email protected]>
Copy link
Member

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

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

As mentioned in #15946 (comment), I think we should keep the old names as aliases.
Even though we can't use the @[Deprecated] annotation, it at least avoids a hard break between 1.16 and 1.17, which is unpleasant if you want to test code with both releases, and maybe some nightlies in between.

@ysbaddaden
Copy link
Contributor Author

ysbaddaden commented Jul 3, 2025

I would consider it if the deprecation wasn't silent or the work around or patch was complex. It's trivial to fix. The whole feature is experimental for a reason: it's expected to break from version to version. We don't expect further changes in the public API. Let's break and be done with it.

EDIT: I added the deprecated aliases. See below.

@straight-shoota straight-shoota added topic:stdlib:concurrency kind:breaking Intentional breaking change with significant impact. Shows up on top of the changelog. and removed kind:docs kind:refactor labels Jul 4, 2025
@ysbaddaden
Copy link
Contributor Author

ysbaddaden commented Jul 4, 2025

Given #15962 I might revise my above opinion: the warning would no longer be silent, but gently loudly yell, and could be helpful to upgrade easily. Sadly it won't make it for 1.17 😭

EDIT: I added the deprecated aliases. The warnings shall be visible after #15962.

The execution context feature is experimental but having an upgrade path
is nicer than an abrupt compilation error. The actual deprecation
warnings shall only appear in Crystal 1.18.
ysbaddaden added a commit to ysbaddaden/crystal that referenced this pull request Jul 13, 2025
@straight-shoota
Copy link
Member

#15962 won't make it into 1.17 due to the feature freeze. We could still merge this PR though because it only affects execution contexts, which are still an experimental API.
The deprecations wouldn't have any effect until compiler support becomes available in the following release (1.18).
We could then remove the deprecated features in 1.19 at the earliest.

@ysbaddaden
Copy link
Contributor Author

@straight-shoota yes, we'll have deprecations in nightly then 1.18, and we can drop them in 1.19 👌

@straight-shoota straight-shoota merged commit 7738038 into crystal-lang:master Jul 15, 2025
36 of 37 checks passed
@github-project-automation github-project-automation bot moved this from Review to Done in Multi-threading Jul 15, 2025
@ysbaddaden ysbaddaden deleted the fix/rename-execution-contexts branch July 15, 2025 08:44
@zw963
Copy link
Contributor

zw963 commented Jul 18, 2025

Should we update RFC0002 doc for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:breaking Intentional breaking change with significant impact. Shows up on top of the changelog. topic:multithreading topic:stdlib:concurrency

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants