Implement a new use syntax#415
Conversation
|
feel free to ignore, but it would be nice if something delineated the list of import names. maybe an extra pair of parens? |
|
Overall this looks good! My biggest concern here is the removal of the top-level |
|
Isn't the outer |
|
I am not personally wed to any particular syntax here, so I'm happy to tweak as necessary for imports/etc. @sunfishcode are you ok with the one-module-per-text-file restriction? (same as It's also true yeah that at least in |
|
One-module-per-file is ok with me. Hmm, I actually forgot that I think my instinct is that we should support and require the |
771f199 to
d2efa00
Compare
This commit implements a new `use` syntax which changes (use "foo.witx") to (use $some $type $names from $foo) This change ended up being much larger than originally intended. While at a surface level switching this style of `use` statements isn't too bad it has large ramifications on the mental model of how to interpret and work with `*.witx` files. This necessitated some internal refactorings which ended up as a bit of a yak shave. The other changes here are: * The `polyfill` module is removed. I confirmed with Pat that this isn't used anymore and this came about trying to update it from the below refactorings. * The `render` module is removed. Documents can no longer be serialized to a standalone s-expression because they can refer to other documents in a structured manner. It's also believed there are no current users of this functionality. * The `representation` module was removed since it was largely only used by the `polyfill` module. * The `Document` type was renamed to `Module`, and the ability for a document to contain multiple modules has been removed. When working with multiple modules this must now be done so explicitly instead of having it all lumped into one parsed object. This means that `Module` is now a list of types and a list of functions. * Documentation has changed to document a set of modules instead of a single module. Additionally this is nontrivially changed to load types transitively from all modules referenced to ensure that all relevant types are documented. * Internal refactorings in the validation phase have been done to streamline a few things and consolidate where possible with this new structuring. * `InterfaceFunc` is now named `Function` * `InterfaceFuncParam` is now named `Param` * `Module` has a `name` (as before) which is now inferred from the filename it's loaded from. * `Module` has a `ModuleId` now to represent types that are defined in other modules, where `ModuleId` is intended to be a unique identifier amongst a set of modules. For now it's just a path name but can likely get more fancy in the future if needed. All `*.witx` files have been updated to the new syntax in this repository. Lots of changes look like they happened to the proposal documentation, but that's just because the documentation order of types has been shuffled around. I've checked to make sure no actual items were lost from the documentation. Closes WebAssembly#378 Closes WebAssembly#379
d2efa00 to
1e3e514
Compare
|
Ok updated! |
This reverts commit fc3da39.
This commit implements a new
usesyntax which changesto
This change ended up being much larger than originally intended. While
at a surface level switching this style of
usestatements isn't toobad it has large ramifications on the mental model of how to interpret
and work with
*.witxfiles. This necessitated some internalrefactorings which ended up as a bit of a yak shave. The other changes
here are:
polyfillmodule is removed. I confirmed with Pat that this isn'tused anymore and this came about trying to update it from the below
refactorings.
rendermodule is removed. Documents can no longer be serializedto a standalone s-expression because they can refer to other documents
in a structured manner. It's also believed there are no current users
of this functionality.
representationmodule was removed since it was largely only usedby the
polyfillmodule.Documenttype was renamed toModule, and the ability for adocument to contain multiple modules has been removed. When working
with multiple modules this must now be done so explicitly instead of
having it all lumped into one parsed object. This means that
Moduleis now a list of types and a list of functions.single module. Additionally this is nontrivially changed to load types
transitively from all modules referenced to ensure that all relevant
types are documented.
streamline a few things and consolidate where possible with this new
structuring.
InterfaceFuncis now namedFunctionInterfaceFuncParamis now namedParamModulehas aname(as before) which is now inferred from thefilename it's loaded from.
Modulehas aModuleIdnow to represent types that are defined inother modules, where
ModuleIdis intended to be a unique identifieramongst a set of modules. For now it's just a path name but can likely
get more fancy in the future if needed.
All
*.witxfiles have been updated to the new syntax in thisrepository. Lots of changes look like they happened to the proposal
documentation, but that's just because the documentation order of types
has been shuffled around. I've checked to make sure no actual items were
lost from the documentation.
Closes #378
Closes #379