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

Document internals #157

Open
felixSchl opened this issue Jul 31, 2018 · 1 comment
Open

Document internals #157

felixSchl opened this issue Jul 31, 2018 · 1 comment

Comments

@felixSchl
Copy link

felixSchl commented Jul 31, 2018

It'd be great to have an overview of how the internals were designed, or to point to literature that served as reference - nothing too fancy. I could be totally wrong about this, but it seems like this project has a very low bus factor for being such a crucial library to rely on. The code is fairly complex - albeit neatly written - JS FFI code that relies on mutation of scoped variables and other runtime intricacies. I've ventured into src/Effect/Aff.js numerous times over the last half a year or so and always come out just as smart as I went in. Knowing what it's trying to do while reading the code or even a reference implementation at hand would ease the learning curve quite a bit, i'd hope.

@natefaubion
Copy link
Collaborator

natefaubion commented Jul 31, 2018

As background https://www.youtube.com/watch?v=dbM72ap30TE might help since it goes through the problems Aff is trying to solve and the approach. As far as implementation goes, specific questions would go a long way towards letting me know what is unclear around decisions made.

The main loop where the magic happens (core interpreter).
https://github.com/slamdata/purescript-aff/blob/c02ae17e7da8c4df75b824c5b18911931bfe7eba/src/Effect/Aff.js#L257-L524

Low-level join logic
https://github.com/slamdata/purescript-aff/blob/c02ae17e7da8c4df75b824c5b18911931bfe7eba/src/Effect/Aff.js#L526-L544

Kill logic
https://github.com/slamdata/purescript-aff/blob/c02ae17e7da8c4df75b824c5b18911931bfe7eba/src/Effect/Aff.js#L546-L594

Interface
https://github.com/slamdata/purescript-aff/blob/c02ae17e7da8c4df75b824c5b18911931bfe7eba/src/Effect/Aff.js#L609-L627

ParAff interpreter. This is so complicated because of stack safety. A stack unsafe implementation is trivial.
https://github.com/slamdata/purescript-aff/blob/c02ae17e7da8c4df75b824c5b18911931bfe7eba/src/Effect/Aff.js#L630-L992

If you wanted to attempt a read-through, and note specific questions about these concepts, I would be happy to elaborate.

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

No branches or pull requests

2 participants