Skip to content

Editorial: rename genContext to calleeContext in RunCallerContext - #3952

Open
Leonabcd123 wants to merge 1 commit into
tc39:mainfrom
Leonabcd123:run-caller-context-naming
Open

Editorial: rename genContext to calleeContext in RunCallerContext#3952
Leonabcd123 wants to merge 1 commit into
tc39:mainfrom
Leonabcd123:run-caller-context-naming

Conversation

@Leonabcd123

@Leonabcd123 Leonabcd123 commented Aug 14, 2026

Copy link
Copy Markdown

The running execution context in RunCallerContext (step 1) is named genContext, even though RunCallerContext is also called from Await, so the context can also be just a normal async function rather than a generator, which makes the current name a bit confusing in my opinion. This pr renames it to calleeContext.

@nicolo-ribaudo nicolo-ribaudo 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.

_innerContext_? As we have two contexts, it's good to have both of them qualified.

@Leonabcd123
Leonabcd123 force-pushed the run-caller-context-naming branch from 1c42935 to 1527c9d Compare August 19, 2026 08:03
@Leonabcd123 Leonabcd123 changed the title Editorial: rename genContext to context in RunCallerContext Editorial: rename genContext to innerContext in RunCallerContext Aug 19, 2026
@Leonabcd123

Leonabcd123 commented Aug 19, 2026

Copy link
Copy Markdown
Author

_innerContext_? As we have two contexts, it's good to have both of them qualified.

Thinking a bit more about the name, I think _calleeContext_ might be better? _innerContext_ isn't used anywhere else in the spec, and the operation is called RunCallerContext, so it makes sense that the context that runs it is the callee.

@jmdyck

jmdyck commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Agreed that _innerContext_ is not appropriate, since AFAICT 'inner'/'outer' isn't terminology that we use for execution contexts anywhere in the spec.

_calleeContext_ would be the natural complement to the AO's _callerContext_ alias. There two drawbacks I can think of:

We should maybe settle that naming question first.

@Leonabcd123

Leonabcd123 commented Aug 19, 2026

Copy link
Copy Markdown
Author

I get why RunSuspendedContext would need to be renamed after removing the concept of suspending an execution context, but I'm not sure why RunCallerContext needs a different name. I think that renaming RunSuspendedContext to RunCalleeContext and keeping RunCallerContext would make the most sense. Could you clarify why you said here that the caller/callee distinction might be misleading?

For now I changed it to calleeContext.

@Leonabcd123
Leonabcd123 force-pushed the run-caller-context-naming branch from 1527c9d to e50e792 Compare August 19, 2026 18:35
@Leonabcd123 Leonabcd123 changed the title Editorial: rename genContext to innerContext in RunCallerContext Editorial: rename genContext to calleeContext in RunCallerContext Aug 19, 2026
@jmdyck

jmdyck commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

I think that renaming RunSuspendedContext to RunCalleeContext and keeping RunCallerContext would make the most sense.

That's a possibility.

Could you clarify why you said here that the caller/callee distinction might be misleading?

The caller/callee distinction normally arises with functions: function A calls function B, so A is the caller and B is the callee. But a transfer of control (in the sense of #2962) is not a function call, so it might be misleading to use the caller/callee terminology. (On the other hand, we might not find anything better.)

@michaelficarra

Copy link
Copy Markdown
Member

Given #2962 rephrases these steps to use the phrasing "transfer control", I agree that caller/callee is not appropriate. I think we should choose names that work well with that phrasing.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants