Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): disableable extensions & ops #14063

Merged
merged 4 commits into from
Mar 22, 2022

Conversation

AaronO
Copy link
Contributor

@AaronO AaronO commented Mar 21, 2022

Streamlines a common middleware pattern and provides foundations for avoiding variably sized v8::ExternalReferences & enabling fully monomorphic op callpaths

Op middleware has the final say on whether an op is enabled/disabled/overridden, otherwise the logic is:

op.enabled = extension.enabled && op.enabled;

Entire extensions can be enabled/disabled, individual ops can also toggled in the extension constructor.

Main semi-open question is if disabled ops should throw or just no-op by mapping to op_void_a?sync thus returning undefined (no-op-ing is our current behaviour so I'm going to stick with that)

Streamlines a common middleware pattern and provides foundations for avoiding variably sized v8::ExternalReferences
@AaronO AaronO requested a review from kt3k as a code owner March 21, 2022 18:47
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

A small unit test in core would be appropriate, I think

@bartlomieju
Copy link
Member

Main open question is if disabled ops should throw or just no-op by mapping to op_void_a?sync thus returning undefined

Throwing is less surprising than silently doing a noop

@AaronO AaronO requested a review from ry March 22, 2022 14:17
Copy link
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

So it looks like you want to silently no op for disabled ops. I don't like this, it's surprising in my opinion

@AaronO
Copy link
Contributor Author

AaronO commented Mar 22, 2022

So it looks like you want to silently no op for disabled ops. I don't like this, it's surprising in my opinion

Disabling ops is already a thing on main and by convention that means remapping to op_void_sync/op_void_async

I'll consider throwing in a follow-up, users can implement throwing in user-land with middleware remapping, so I'm currently unconvinced it should be the default. This is all low-level-ish stuff and caveat emptor ...

@AaronO AaronO merged commit f81334d into denoland:main Mar 22, 2022
@AaronO AaronO deleted the feat/core-disabled-extensions branch March 22, 2022 15:40
dsherret pushed a commit that referenced this pull request Apr 7, 2022
Streamlines a common middleware pattern and provides foundations for avoiding variably sized v8::ExternalReferences & enabling fully monomorphic op callpaths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants