component-model icon indicating copy to clipboard operation
component-model copied to clipboard

Overlap between outer alias encodings

Open alexcrichton opened this issue 3 years ago • 2 comments

Currently in Binary.md it looks like there's two different ways to alias an outer core wasm type. One is using core:alias with sort as 0x10/type. The other is using alias with sort as 0x00 0x10 which is also core type. I think in the text format these are currently disambiguated as:

(core alias outer $C $outer_name (type $inner_name))

;; ... vs ...

(alias outer $C $outer_name (core type $inner_name))

I wanted to confirm though that this was intended because this seems like it may not be desired. For example a text-to-binary encoder which implements automatically injecting core outer aliases now has to pick which encoding to use here and while one could be specified it seems unfortunate to have to make a choice in the first place.

I think this is also roughly the same issue for modules where core modules could be aliased via either of the two encodings above but I would naively at least expect there to only be one encoding.

alexcrichton avatar Jul 05 '22 17:07 alexcrichton

You're right that there are two ways to alias an outer core wasm type. It's currently intended with the meaningful difference being that core aliases index the core-instance index space whereas component-level aliases index the component-instance index space. Thus, the distinction is in the "path" taken to get to the target core definition.

lukewagner avatar Jul 05 '22 19:07 lukewagner

I think #95 also resolves this?

lukewagner avatar Aug 17 '22 17:08 lukewagner