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

#57: cage recursion #59

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

levBagryansky
Copy link
Member

@levBagryansky levBagryansky commented Mar 18, 2024

Closes #57


PR-Codex overview

The focus of this PR is to address recursion issues in the cage object by implementing a mechanism to detect and handle deep recursion.

Detailed summary

  • Added a blog post discussing recursion in cage
  • Updated the EOcage::lambda method to detect and handle recursion
  • Introduced PhTracedEnclosure to track and handle recursion in cage dataization

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link
Member Author

@levBagryansky levBagryansky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_posts/2024/03/2024-03-18-cage-recursion.md Outdated Show resolved Hide resolved
FALSE
cge > @

```
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxonfjvipon this is more illustrating example, not working code,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@levBagryansky why doesn't it work? Everything seems fine

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxonfjvipon I get an error EOcorrect_cage_recursionTest.works:124->PhDefault.attr:250->PhDefault.attr:248->PhDefault.attr:250 » Ex D="Error at "EOorg.EOeolang.EObytes$EOas_bool#φ" attribute; caused by Can't #copy() package object 'bytes'" here and don't know why

@maxonfjvipon
Copy link
Member

@levBagryansky reading...

_posts/2024/03/2024-03-18-cage-recursion.md Outdated Show resolved Hide resolved
_posts/2024/03/2024-03-18-cage-recursion.md Outdated Show resolved Hide resolved
_posts/2024/03/2024-03-18-cage-recursion.md Outdated Show resolved Hide resolved
_posts/2024/03/2024-03-18-cage-recursion.md Outdated Show resolved Hide resolved
_posts/2024/03/2024-03-18-cage-recursion.md Outdated Show resolved Hide resolved
FALSE
cge > @

```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@levBagryansky why doesn't it work? Everything seems fine

return this.attr("enclosure").get();
}
```
That is, when dataizing, `cage` simply returned its `enclosure`. In order to trace how many times
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@levBagryansky I think we should explain what is enclosure here because readers may not know the internal structure of the cage.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_posts/2024/03/2024-03-18-cage-recursion.md Outdated Show resolved Hide resolved
```
`PhTracedEnclosure` keeps `enclosure` and `cage` that it traces. It also has something like **static**
`Map<Phi, Integer>`, where it counts how many times `enclosure` was used: It increments `cage`'s
counter before calling `enclosure::attr` method and decrement after. Thus, in the case of recursion,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@levBagryansky I would replaced "calling enclosure::attr" with something more neutral, because it looks like very deep details of our implementation. I think here we should describe the main concept how we resolved the recursion, but not go deep into java implementation details

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxonfjvipon Reduced the amount of java, but the basic principle is still described in terms of java, like Map adndstatic. I seems to me such approach does not go to implementation too deeply.

@levBagryansky
Copy link
Member Author

@maxonfjvipon Maybe there are problems with rho in this snippet?

# correct-cage-recursion.
[] > correct-cage-recursion
  cage > cge
    if.
      i.as-bool
      TRUE
      seq
        *
          i.write
            TRUE
          $.cge
  memory > i
    FALSE
  cge > @

@levBagryansky
Copy link
Member Author

@maxonfjvipon I think we should either release it as how it worked before, or delay its release until we can fix it in a future version.

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

Successfully merging this pull request may close these issues.

Blog post about cage recursion and how we resolved that
2 participants