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

Explain what is Package #2940

Closed
deemp opened this issue Mar 13, 2024 · 8 comments
Closed

Explain what is Package #2940

deemp opened this issue Mar 13, 2024 · 8 comments
Labels

Comments

@deemp
Copy link
Member

deemp commented Mar 13, 2024

@yegor256, @maxonfjvipon

I do eoc phi on unit-tests.eo and get the following .phi program that contains λ ⤍ Package mappings.

{
  ⟦
    org ↦ ⟦
      eolang ↦ ⟦
        x ↦ ⟦
          φ ↦ Φ.org.eolang.bool(
            α0 ↦ Φ.org.eolang.bytes(
              Δ ⤍ 01-
            )
          )
        ⟧,
        z ↦ ⟦
          y ↦ ⟦
            x ↦ ∅,
            φ ↦ ξ.x
          ⟧,
          φ ↦ Φ.org.eolang.bool(
            α0 ↦ Φ.org.eolang.bytes(
              Δ ⤍ 01-
            )
          )
        ⟧,
        λ ⤍ Package
      ⟧,
      λ ⤍ Package
    ⟧
  ⟧
}

What is a Package?

How to dataize it?

@deemp deemp changed the title Explain what is λ ⤍ Package Explain what is Package Mar 13, 2024
@maxonfjvipon
Copy link
Member

maxonfjvipon commented Mar 14, 2024

@deemp when you write EO program, you create EO files, EO files may be placed in some directories, for example:

| root
|---| org
    |---| eolang
        |--- app.eo

In EO we don't have such entity as "package". The only entities we have in EO are objects. Global object Ф "lives" in the root directory, every folder is a special package object with some "magic" inside. This magic allows this object to find other package-objects or regular objects (which are placed in .eo files) by scan current directory. We don't see this magic in EO, it's behind the scene. That's why this magic is placed in λ attribute of such package-objects. Package is just a name of the function that do this magic for current package-object.

Here you need to dataize org.eolang.x or org.eolang.z object.

@fizruk
Copy link

fizruk commented Mar 14, 2024

@maxonfjvipon Thank you for the explanation! The question is rather how to properly handle this atom in the normalizer. When you say

Here you need to dataize org.eolang.x or org.eolang.z object.

It is unclear instruction for the normalizer. I assume that we want to dataize both, but preserving their context (enclosing objects). So in @deemp's example, we would expect the result to be

{
  ⟦
    org ↦ ⟦
      eolang ↦ ⟦
        x ↦ ⟦ Δ ⤍ 01- ⟧,
        z ↦ ⟦ Δ ⤍ 01- ⟧,
        λ ⤍ Package
      ⟧,
      λ ⤍ Package
    ⟧
  ⟧
}

Is my understanding correct?

@maxonfjvipon
Copy link
Member

maxonfjvipon commented Mar 14, 2024

@fizruk here x and z are two independent and equal rights objects. And there's only one entry point for dataization process. It can either be org.eolang.x or org.eolang.y. You can't dataize them both during one dataization process. If you want it - introduce one more object which would use x and z.

{
  ⟦
    org ↦ ⟦
      eolang ↦ ⟦
        x ↦ ⟦ Δ ⤍ 01- ⟧,
        z ↦ ⟦ Δ ⤍ 01- ⟧,
        a ↦ ⟦ φ ↦ ξ.ρ.x.plus(α0 ↦ ξ.ρ.z) ⟧,
        λ ⤍ Package
      ⟧,
      λ ⤍ Package
    ⟧
  ⟧
}

Here you can dataize org.eolang.a and it dataizes x and z. @yegor256 correct me, if I'm wrong

@yegor256
Copy link
Member

yegor256 commented Mar 15, 2024

@deemp to answer the original question: "how to dataize λ ⤍ Package?" --- in case of phi-calculus expression, you can simply assume that the Package atom always returns an error. If this is my expression:

{
  ⟦
    org ↦ ⟦
      eolang ↦ ⟦
        x ↦ ...,
        λ ⤍ Package
      ⟧
    ⟧
  ⟧
}

And I dataize Q.org.eolang.x -- I get something, if I dataize Q.org.eolang.y -- I get an error.

In Java, Q.org.eolang.y runs λ ⤍ Package, which attempts to find y somewhere in Java classpath and then returns an object. In phi-calculus we don't do this, since the entire universe of objects is already in front of us.

@maxonfjvipon maybe we can simply remove λ ⤍ Package from the expression, when we do the XMIR to phi conversion? Or we need it for the unphi process?

@maxonfjvipon
Copy link
Member

@yegor256 yes, this lambda is used while unphi process

@maxonfjvipon
Copy link
Member

@deemp are there any more questions?

@deemp
Copy link
Member Author

deemp commented Mar 15, 2024

@maxonfjvipon, I don't have any.

@maxonfjvipon
Copy link
Member

@deemp then I'm closing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants