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

Is it forbidden to use an object by FQN? #537

Closed
i582 opened this issue Dec 25, 2021 · 9 comments
Closed

Is it forbidden to use an object by FQN? #537

i582 opened this issue Dec 25, 2021 · 9 comments

Comments

@i582
Copy link

i582 commented Dec 25, 2021

I am trying to compile a small script:

+package main

[args...] > main
  org.eolang.io.stdout > @
    "Hello World"

But I get the error:

[ERROR] Failed to execute goal org.eolang:eo-maven-plugin:0.21.5:assemble (default) on project
 eo-parent: Execution default of goal org.eolang:eo-maven-plugin:0.21.5:assemble failed:
 org.apache.maven.plugin.MojoFailureException: Failed to execute org.eolang.maven.PullMojo:
 Failed while trying to save to ./target/eo/04-pull/org/eolang/org.eo: https://raw.githubusercontent.com/yegor256/objectionary/master/objects/org/eolang/org.eo ->
 [Help 1]

It turns out that I cannot use the object by its FQN? That is, I always need to write +alias ... at the beginning if it is an object not from the current package?

Also, if you write FQN in the first identifier for the alias:

+package main
+alias io.stdout org.eolang.io.stdout

[args...] > main
  io.stdout > @
    "Hello World"

And then try to use it, you will get the same error.

I think it's worth adding this to the formal language description so that users don't have a question in the future.

@yegor256
Copy link
Member

@i582 once we fix #531, it will be possible to do this:

+package main

[args...] > main
  /org/eolang/io/stdout > @
    "Hello World"

@yegor256
Copy link
Member

@i582 I closed #531, it was a wrong idea, it seems (thanks to your ticket, which provoked thinking). It will work like this instead:

+package main

[args...] > main
  /.org.eolang.io.stdout > @
    "Hello World"

Here, / is the root object Φ.

@i582
Copy link
Author

i582 commented Dec 25, 2021

@yegor256 By the way, the use of FQN there can introduce some ambiguity:

For example:

+package main

[args...] > main
  /.org.eolang.some-object-with-property.property-name > @
    "Hello World"

Can we determine at the parsing stage that property-name is just a property, and not an object inside the package /.org.eolang.some-object-with-property.property-name? It seems that at the parsing stage this is impossible, but it seems that later it will be possible to determine this when all the symbols are known.

But such ambiguity is not very good, since reading the code it will not be clear what it is, a property or an object inside the package.

@i582
Copy link
Author

i582 commented Dec 25, 2021

@yegor256 In general, I don't see much point in allowing FQN to be used in such places, if the user wants to use the object, they must first import it explicitly.

If this is described in a formal description, then, it seems to me, everything will be fine.

@yegor256
Copy link
Member

@i582 we have to make "packages" also objects. Thus, /.org.eolang will be an object, and /.org also an object.

yegor256 added a commit that referenced this issue Mar 26, 2022
yegor256 added a commit that referenced this issue Mar 26, 2022
@yegor256
Copy link
Member

@rultor release, tag is 0.22.0

@rultor
Copy link
Contributor

rultor commented Mar 26, 2022

@rultor release, tag is 0.22.0

@yegor256 OK, I will release it now. Please check the progress here

@rultor
Copy link
Contributor

rultor commented Mar 26, 2022

@rultor release, tag is 0.22.0

@yegor256 Done! FYI, the full log is here (took me 15min)

@yegor256
Copy link
Member

@i582 now it's possible to do this:

+package main

[args...] > main
  Q.org.eolang.stdout > @
    "Hello World"

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

No branches or pull requests

4 participants