Skip to content

Commit

Permalink
Split augmentations into improved part files and augmentation declara… (
Browse files Browse the repository at this point in the history
#3800)

* Split augmentations into improved part files and augmentation declarations.

Unifies "augmentation libraries" and part files.
Part files can have imports, exports and further part files.
Part files can use configurable URIs.
A `part of` directive can no longer use a library name.
Part files inherit the imports of their parent file, and can
extend or shadow those with their own imports.

Augmentation declarations can occur in any part or library file.
An augmentation must occur "below" the declaration it augments:
Either later in the same file ("below" when viewing code),
or in the file-tree of a part file of the same file ("below" in
the part-file tree of the library).

This ensures that the original declaration occurs above all
augmentations of it, and that all augmentations of the same
original declaration occur on a single path down the part-file tree
of the library. What again ensures that reordering `part` directives
does not change the order of augmentations.

Changed the lexical scope of augmenting class-like declarations
(declarations with a member scope) to only contain the members
declared inside the same class-like declaration, not the collection
of all members declared by all declarations with the same name.

Rewrote the part about applying augmentations. This is more
speculative since it doesn't provide a complete definition,
but more of a pattern for extending semantics that assume a
name refers to a single declaration, into one where a name
denotes a set (stack depending on augmentation application order),
of individual syntactic declarations.
The existing semi-syntactic "merging" may not be a viable
specification approach, since it requires merging code
from different scopes into a single scope. That's not impossible,
we also move code around for mixin applications, but it's also
easy to get wrong.
  • Loading branch information
lrhn authored Jun 28, 2024
1 parent 314434d commit 70e5694
Show file tree
Hide file tree
Showing 2 changed files with 1,288 additions and 549 deletions.
Loading

0 comments on commit 70e5694

Please sign in to comment.