fix: replace removed Thread.sleep in concurrency.md (#314) - #315
Merged
Conversation
Thread.sleep, Time.Duration.fromSeconds, and the single-arg Channel.timeout no longer exist in the current Flix API. - Drop the slowPrint helper from the structured-concurrency example; it only existed to inject a Thread.sleep delay. - In the timeout example, reproduce the slow sender's delay with a Channel.timeout receiver (Chan + IO, both legal in spawn) since the new Sleep effect is not allowed inside spawn. Update Channel.timeout calls to the two-argument (Int32, Time.TimeUnit) form. Both examples verified with flix check (0.72.0). Closes #314 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Thread.sleephas been removed from Flix (#314). The only references were insrc/concurrency.md. Two related APIs are also gone in the current version:Time.Duration.fromSeconds(...)and the single-argumentChannel.timeout(...).Changes
slowPrinthelper, which only existed to inject aThread.sleepdelay; now spawnsprintlndirectly. The region-lifetime point it illustrates is unchanged.slowsender genuinely needs to be slow or theselecttimeout never fires. The newSleepeffect is not allowed insidespawn, so the delay is reproduced with aChannel.timeoutreceiver (Chan + IO, both legal inspawn). Updated bothChannel.timeoutcalls to the two-argument(Int32, Time.TimeUnit)form.No prose changes were needed — surrounding text remains accurate (the slow function still takes a minute; the program still prints
"timeout"after five seconds).Verification
Both examples checked against the current API (api.flix.dev) and compiled cleanly with
flix check(Flix 0.72.0).Closes #314
🤖 Generated with Claude Code