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

interpreters have trouble comparing shared methods when mixed intern/extern #4732

Open
ggreif opened this issue Oct 14, 2024 · 0 comments
Open
Assignees

Comments

@ggreif
Copy link
Contributor

ggreif commented Oct 14, 2024

#4719 has introduced the (actor, method)-style endpoint references (to obtain the semantics which the compiler has pioneered). But we still have the possibility of non-public shared functions, which are just closures. So when comparing the mixed case can occur and currently this crashes the interpreters.

Two things come to my mind how to salvage this:

  • where we have an env we could change the pair representation to a raw continuation and pass that down to the comparison
  • put private dared methods in actor_env too (they cannot be used from extern anyway, as the type system will prevent it). Then we will never have raw continuations around for shared and comparison becomes trivial. Calling them would need the conversion to raw costs.

One thing worth to try out: see "crazy idea" in #4719 comments.

@ggreif ggreif changed the title interpreters have trouble comparing shared methods when mixd intern/extern interpreters have trouble comparing shared methods when mixed intern/extern Oct 14, 2024
@ggreif ggreif self-assigned this Oct 17, 2024
mergify bot pushed a commit that referenced this issue Oct 17, 2024
…ialisers (#4719)

This PR accomplishes following improvements:
- allow `actor Self { ... Self ... }` in the actor initialiser (similarly for `actor class`)
- ditto for accessing all public methods `Self.method` from the actor initialiser
- accessing these from under lambdas without making the respective methods undefined when using them

The latter should allow setting up timers: `addTimer(b, period, Self.method)` from actor initialiser.

Also fixes the hole in definedness analysis (#4731).

-------------
_NOTES_:
- calling `Self.method` from actor initialiser is prohibited by the capability checker
- accessing `Self.method` from actor initialiser is currently allowed when `method` is not defined yet, and results in a descriptor (pair)
- comparison (in terms of `shared`) of the internal methods with external methods is trapping in the interpreter, but should work in the deployed actor.

There is an idea inside to fix these problems.

----
TODO:
- adapt `renaming.ml`? — nope, I don't have business in IR
- [x] test `actor class` too
- [x] test clashing `Self` — there is already `self-shadow.mo`
- [x] `test/run/issue1464ok.mo` fails — fixed snafu
- [x] deal with `FIXME`s
- [x] `shared` method equality in the interpreters
- [x] `shared` call viability checking (in interpreters)
- [x] fix #4731
- [x] write issue about the mixed (pair/closure) `shared func` comparison problem — here: #4732
- [x] resolve the `Promise.is_fulfilled` problem — #4735
- [x] check the "For actors, this may be too permissive" comment in the code — irrelevant, removed!
- [ ] try out the "crazy idea" mentioned in the feedback
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

1 participant