deno_core icon indicating copy to clipboard operation
deno_core copied to clipboard

Clean up op registration

Open bartlomieju opened this issue 1 year ago • 0 comments

Currently all registered ops are "added" as JavaScript bindings twice:

  1. To Deno.core.ops module in: https://github.com/denoland/deno_core/blob/ce620969c447d5cd7d7c21e1b95bc120c67142be/core/runtime/bindings.rs#L268-L298

  2. To ext:core/ops synthetic module in: https://github.com/denoland/deno_core/blob/ce620969c447d5cd7d7c21e1b95bc120c67142be/core/runtime/bindings.rs#L773-L796

We actually need both approaches - the former is for 01_core.js (that is a plain script and can't import ext:core/ops) and the latter for embedder code (though we still haven't migrated yet).

I think we could unify this - when getting exports for synthetic module we should assign ops to Deno.core.ops.

Alternative approach is that "internal ops" - ie. ops from deno_core could be added to Deno.core.ops and the remaining ops could be added to the synthetic module. Not sure yet, but I'll figure this out along the way.

bartlomieju avatar Jan 25 '24 23:01 bartlomieju