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

jeo.method includes too many unnecessary empty elements #978

Open
yegor256 opened this issue Jan 20, 2025 · 5 comments
Open

jeo.method includes too many unnecessary empty elements #978

yegor256 opened this issue Jan 20, 2025 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@yegor256
Copy link
Member

This is what I see in XMIR:

<o base="jeo.method" name="j$foo-%28%29%5BB">
  ...         
  <o base="jeo.params"/>
  <o base="jeo.seq.of0" name="annotations-35144683"/>
  <o base="jeo.seq.of11" name="body-1337806054"> ... </o>
  <o base="jeo.seq.of0" name="trycatchblocks-foo-750353843"/>
  <o base="jeo.seq.of0" name="local-variable-table-704374111"/>
</o>

These tailing parts, related to annotations, trycatchblocks and localvars are seen in every method declaration, even when they are empty. How about creating a set of atoms instead:

jeo.method
jeo.method-with-try-catch
jeo.method-with-annotations
jeo.method-with-try-catch-and-annotations
jeo.method-with-everything

Usually (very often), the first one will be used, which is the most compact. Thus, the size of phi expressions will be reduced.

@yegor256
Copy link
Member Author

@volodya-lombrozo please, check

@volodya-lombrozo
Copy link
Member

@yegor256 I just can try to omit empty blocks at all

@volodya-lombrozo volodya-lombrozo self-assigned this Jan 21, 2025
@volodya-lombrozo volodya-lombrozo added the enhancement New feature or request label Jan 21, 2025
@yegor256
Copy link
Member Author

@volodya-lombrozo keep in mind that we can't have jeo.method with three arguments in one place and then jeo.method with five in another place.

@volodya-lombrozo
Copy link
Member

@yegor256 Why not?

@yegor256
Copy link
Member Author

@volodya-lombrozo you will get a warning: objectionary/lints#259 The reason behind this is that there is no reflection in EO: an atom (jeo.method) can't, in runtime, understand what arguments have been passed to it. We do have partial application in EO, but again, it's not applicable in your case -- it's only used for object step-by-step construction, but not for for its "deconstruction" in runtime.

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

No branches or pull requests

2 participants