Skip to content

Conversation

@lack-of-gravity-jack
Copy link
Contributor

@lack-of-gravity-jack lack-of-gravity-jack commented May 1, 2025

Changes

common misconception is that people think defer "defers" to a later frame

Checks

By submitting your pull request for review, you agree to the following:

  • [ x] This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses.
  • [x ] I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses.
  • [x ] To the best of my knowledge, all proposed changes are accurate.

@lack-of-gravity-jack lack-of-gravity-jack requested a review from a team as a code owner May 1, 2025 20:02
@github-actions github-actions bot added the engine reference Changes the Engine API Reference documentation label May 1, 2025
@ownerofclassicobby
Copy link

Changes

common misconception is that people think defer "defers" to a later frame

Checks

By submitting your pull request for review, you agree to the following:

  • [ x] This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses.
  • [x ] I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses.
  • [x ] To the best of my knowledge, all proposed changes are accurate.

Thanks you have permission to code and add updates

@github-actions github-actions bot added the changes requested This pull request has changes requested prior to merging label May 1, 2025
@IgnisRBX
Copy link
Contributor

IgnisRBX commented May 1, 2025

Hi @lack-of-gravity-jack,
I checked with engineering and they'd like to clarify but simplify task.defer() to this:

Accepts a function or a thread (as returned by Library.coroutine.create()) and defers it until the end of the current resume point within the current frame.

I also made a bunch of small edits to fix minor grammar and un-linked APIs.

IgnisRBX
IgnisRBX previously approved these changes May 1, 2025
@Roblox Roblox deleted a comment from ownerofclassicobby May 1, 2025
Copy link
Contributor Author

@lack-of-gravity-jack lack-of-gravity-jack left a comment

Choose a reason for hiding this comment

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

Looks good to me

I noticed references to fastSpawn in task.spawn section. I personally didn't know what fast spawn was and after looking around a bit, it seems like a workaround to the legacy spawn()'s yielding behavior, to get a new thread to run instantaneously using bindables (this may be incorrect). I feel like this tidbit is unnecessarily confusing to leave in there now that there's been no reason to use this fastSpawn pattern for many years. Also, I don't believe the fastspawn pattern would even work anymore since events are deferred

the bit about task.spawn not being a replacement for legacy spawn can be clarified instead as
"Unlike the deprecated global spawn() function, this function resumes the accepted function/thread immediately"

@IgnisRBX
Copy link
Contributor

IgnisRBX commented May 2, 2025

Good call on researching the fastSpawn bit and flagging for removal (I did so). And I'll just let the intro paragraph for task.spawn() speak for itself instead of drawing relation to the deprecated spawn() function. Thanks again for your contributions!

@IgnisRBX IgnisRBX merged commit b3f7d09 into Roblox:main May 2, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes requested This pull request has changes requested prior to merging engine reference Changes the Engine API Reference documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants