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

Implement Type Erasure #6985

Open
lukewilliamboswell opened this issue Aug 13, 2024 · 2 comments
Open

Implement Type Erasure #6985

lukewilliamboswell opened this issue Aug 13, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request mono monomorphization

Comments

@lukewilliamboswell
Copy link
Collaborator

lukewilliamboswell commented Aug 13, 2024

zulip discussion

Ayaz's description high level of how it should be implemented

An old WIP PR

example of a program and the corresponding IR

Ayaz offered the following are missing pieces:

  • Reference counting. The erased closure layout has a slot for a pointer to a function that performs refcounting on the closure data, but the pointer is never populated right now. some works needs to be done to store a reference to the refcounting function that should be generated, and insert the pointer appropriately. I'm sure this is not that hard to do, but I don't know the details off the top of my head.
  • Abilities. This is actually very simple, the main thing is that all the machinery to support abilities with lambda sets (there's a lot of it, if you see anything about "ambient functions" that has to do with it) needs to be skipped. I'm happy to explain what needs to be done to support resolution of abilities in the erasure world when it comes time (I think it's very simple, it's like one new check I believe)
  • Some fixes to the mono IR. There are a number of todos related to erased closures that will need to be resolved. One I am aware of is passing closures to higher-order functions by value does not work right now, just because that branch is a TODO.
@lukewilliamboswell lukewilliamboswell added enhancement New feature or request mono monomorphization labels Aug 13, 2024
@smores56 smores56 self-assigned this Aug 13, 2024
@smores56
Copy link
Collaborator

Quick update: @ayazhafiz has come up with a working MVP experiment of properly working lambda sets, as mentioned here on the Zulip chat. Assuming we are able to translate everything properly, we will likely not need type erasure anymore, as it was intended as a stop-gap for what Ayaz has put together.

@ayazhafiz
Copy link
Member

ayazhafiz commented Aug 16, 2024 via email

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

No branches or pull requests

3 participants