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

resolve-aliases.xsl must participate in the canonical train #3799

Closed
yegor256 opened this issue Jan 10, 2025 · 2 comments
Closed

resolve-aliases.xsl must participate in the canonical train #3799

yegor256 opened this issue Jan 10, 2025 · 2 comments

Comments

@yegor256
Copy link
Member

Currently, if I parse this code:

+alias stdout

I will get this XMIR:

<program>
  <metas>
    <meta>
      <head>alias</head>
      <tail>stdout</tail>
      <part>stdout</part>
    </meta>
  </metas>

This is misleading, since this short format is just a syntax sugar. Full format is this:

<program>
  <metas>
    <meta>
      <head>alias</head>
      <tail>stdout org.eolang.stdout</tail>
      <part>stdout</part>
      <part>org.eolang.stdout</part>
    </meta>
  </metas>

This de-sugaring is done by resolve-aliases.xsl, which is not part of the TrCanonical. I believe, it should be.

@maxonfjvipon
Copy link
Member

@yegor256 are you sure we need to resolve such aliases with default package? We already have add-default-package.xsl which would add org.eolang. before stdout in source code and it does not require +alias. So there's a kind of functionality duplication and it's a bit confused

I think we should assume that all objects in aliases are started from Q., which means +alias stdout is:

<metas>
  <meta>
    <head>alias</head>
    <tail>stdout Q.stdout</tail>
    <part>stdout</part>
    <part>Q.stdout</part>
  </meta>
</metas>

It works just fine for common aliases that we use in EO sources, like +alias org.eolang.io.stdout, which is:

<metas>
  <meta>
    <head>alias</head>
    <tail>stdout Q.org.eolang.io.stdout</tail>
    <part>stdout</part>
    <part>Q.org.eolang.io.stdout</part>
  </meta>
</metas>

@yegor256
Copy link
Member Author

@maxonfjvipon my mistake, you are right.

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