Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisiting core vs component aliases #89

Closed
pl-semiotics opened this issue Aug 15, 2022 · 1 comment
Closed

Revisiting core vs component aliases #89

pl-semiotics opened this issue Aug 15, 2022 · 1 comment

Comments

@pl-semiotics
Copy link
Collaborator

pl-semiotics commented Aug 15, 2022

Currently, component definitions include both core-prefixed core aliases and component-level aliases. However, since the component-level sorts include core sorts (sort ::= ... | core <core:sort>), this leads to significant overlap.

In particular, most noticeably, core outer aliases such as (core alias outer <u32> <u32> (<core:sort> <id>?)) are entirely equivalent to component outer aliases written (alias outer <u32> <u32> (core <core:sort> <id>?)).

More subtly, significant issues arise with regards to the alternative syntaxes for export aliases. Core export aliases are subtly different from component export aliases at the moment: a core export alias retrieves an export from a core instance, while a component export alias retrieves an export from a component instance. This similar syntax, however, gives rise to questions, especially about the inverted definition form: is (core <core:sort> <id>? (alias export <idx> <name>)) equivalent to (alias export <idx> <name> (core <core:sort> <id>?)) or to (core alias export <idx> <name> (<core:sort> <id>?))? Furthermore, does the inline export alias syntax (<sort> <idx> <name>) desugar to a core or component export alias?

In the past, we resolved these ambiguities by removing the entire idea of a core alias from the spec, and noting that core export aliases were not useful at the time. The former has been made untenable by the necessity, which has since become clear, of including core export aliases in core:moduledecl; the latter is likely to change in the near future and is not a good assumption to make, so core aliases were re-added in their original form, giving rise to these questions.

I would suggest that we move core:alias to the discussion on core module types, and make it purely a part of core:moduledecl, and then enhance component aliases to include a new aliastarget making it possible to index into the core instance index space rather than the component instance index space. This would nicely (a) remove the "two different syntax trees/operations that are identical" smell and (b) solve the issue with inverted out-of-line aliases nicely. The inline export alias syntax is another matter, and needs to either be fixed to always refer to one of component or core modules, or replaced with something that has an extra position allowing the distinction to be made (e.g. splitting it into (<sort> <idx> <name>) and (<sort> core <idx> <name>).

@pl-semiotics pl-semiotics changed the title Revisiting core vs component export aliases Revisiting core vs componen aliases Aug 15, 2022
@pl-semiotics pl-semiotics changed the title Revisiting core vs componen aliases Revisiting core vs component aliases Aug 15, 2022
@lukewagner
Copy link
Member

Great observations and suggestions; I'll give it a try. As for what to do about inline alias sugar, I expect the vast majority of aliases will be satisfied if, in (core <core:sort> $inst <name>), $inst indexes the core instance index space, so I think it's fine to just do that.

lukewagner added a commit that referenced this issue Aug 17, 2022
lukewagner added a commit that referenced this issue Aug 17, 2022
lukewagner added a commit that referenced this issue Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants