WebAssembly / component-model

Repository for design and specification of the Component Model
Other
971 stars 81 forks source link

Add an `include` keyword #174

Closed Mossaka closed 1 year ago

Mossaka commented 1 year ago

As proposed by #169 , this PR adds an include keyword to the WIT.md. It also sorts the keyword list alphabetically.

Mossaka commented 1 year ago

Could you expand a bit about the semantic meaning of the include statement? For example when with is required, what with does, when include might fail, etc.

Good suggestion. I have thought about that but then I saw the section I've modified is for Lexical Structure. Is there a dedicated section for semantic structure of WIT? If not, I can expand the the semantic meaning in the part where I modified. @alexcrichton

alexcrichton commented 1 year ago

The top of the document is probably the best place for that right now, probably around the area that worlds are explained.

Mossaka commented 1 year ago

so if the same interface is imported into two worlds which are union'd then it's required that a deduplication happens rather than emitting two separate imports (e.g. resolving with with isn't valid)

That's a really good point. Transient deps are always hard haha. I will update the doc to include de-dep semantics.

danbugs commented 1 year ago

~one way to make this less verbose than:

world union-my-world {
     include self.my-world-1
     include self.my-world-2
}

... could be to change the world word itself – something like universe might be fitting:

universe union-my-world {
     self.my-world-1,
     self.my-world-2
}

Of course, this would mostly just be syntactical sugar – the union of worlds should still equate to a world.

Mossaka commented 1 year ago

@alexcrichton thanks for reviewing. Could you please take another look?

Mossaka commented 1 year ago

I will rebase once #198 is merged in.

Mossaka commented 1 year ago

Okay, I think this PR is ready to review @guybedford

Mossaka commented 1 year ago

Thank you, @lukewagner !! I have committed your suggestions.

Mossaka commented 1 year ago

Thanks everyone for reviewing this!! This meant a lot to me as it marks the first contribution I've contributed to a Wasm proposal. Cheers 🙌 🥂