Skip to content

Stage 2.7 Spec Review - Guy Bedford #12

@guybedford

Description

@guybedford

Thanks for the patience on this one, here's my review. Overall the spec text is clear and comprehensive. The semantics and design mostly seem correct, down to basic questions around naming and structure and then just two main questions - the one you are already bringing up at plenary around defer being needed on reexports, and then also a new question I have about the interaction between deferred namespace imports and these optional reexports, which I've posted separately in #11.

I do still have concerns about (a) implementation complexity and (b) ecosystem effects here. In particular, how much burden this will put on implementations to extend the module system, and if we truly want to encourage community convergence on these barrel file patterns as outstanding questions respectively. I would like to see further engagement / feedback on both of these questions before progressing to Stage 3.

Spec Review

Abstract Module Records

  • Typo: should be [[DeferredModules]] with "s" in ResolveExport method on Abstract Methods table
  • importedNames as a Link() arg needs to be marked as an addition

Cyclic Module Records

  • What is the motivation for OptionalIndirectExports on CyclicModuleRecord over Source Text Module Record? It seems a little strange to have only this one separate, also not in the "Additional Module Fields" section. I would be interested to hear more about the justification here. If for synthetic module records, not clear how they would utilize this property? Wasm wouldn't use it either. I think I would prefer if we kept this to STMR only.

GraphLoading State Record

  • I’m uneasy about [[Visited]] as containing “records with fields” [[Module]] and [[ImportedNames]]. I think we should rather explicitly state the top-level type list that this is rather, and formally define the OptionalImport Record as the other type with just those fields or whatever we want to call that.

Link

  • It would be nice to see a better explanation for what importedNames is in the context of link and how it is used, the description doesn't say much about this. Partial linking is an important concept to describe, a short note could be useful.

BuildLinkingList

  • Can we call remainingImportedNames newImportedNames for clarity? Took me a moment to follow this.
  • Exclude followed by Merge can just be written as an append of remaining / new for simplicity, or turned into its own abstract operation since these are commonly done together. In fact all four steps together - find in visited, exclude, merge, get optional seem to always go together such that this could be a single abstract op on a list and remove duplication?

InnerModuleEvaluation

  • I do have some concerns about execution ordering and BuildEvaluationList - would it help to open another issue to discuss this? Am I understanding correctly that we are doing a post order unrolling of the optional imports? By not tracking a stack for these doesn't that mean that strongly connected components within the optional graph are not being tracked?

Static Semantics: Module Requests

  • ModuleRequestsEqual is now very much ModuleRequestsKeysEqual, could be worth a rename here
  • Neither defer nor source phases have ImportedNames - would be nice to have an assert when phase checking that it is empty for defer phase

Static Semantics: Imported Names

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions