Skip to content

Conversation

komyg
Copy link
Contributor

@komyg komyg commented Jul 22, 2025

No description provided.

@komyg komyg force-pushed the feature/promise.all branch from 5013ece to d6226b1 Compare July 28, 2025 23:30
@komyg komyg force-pushed the feature/promise.all branch 3 times, most recently from 297b697 to 493bcde Compare August 12, 2025 10:09
Copy link
Member

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

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

Great job so far! The heap addition looks really good, though some parts are missing.

@komyg komyg force-pushed the feature/promise.all branch from b0bd7ff to c86a082 Compare August 19, 2025 10:17
@komyg komyg requested a review from aapoalas August 19, 2025 12:32
@komyg
Copy link
Contributor Author

komyg commented Aug 19, 2025

Hey @aapoalas, I've implemented all your suggestions, could you review again?

Notes:

  • The changes in promise_constructor.rs are still WIP, so you don't have to review that.
  • I get promise_jobs.rs to compile, but i don't think I am using the GC correctly, because it is not following the guidelines in the readme, could you help me here?

Copy link
Member

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

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

Couple of small points around PromiseAll and PromiseAllRecord, but generally those were just nitpicks (that we do want to fix though :) ). Generally, this looks exactly correct! Now it's just a matter of finishing up the Promise.all method itself. Great work! <3

@komyg komyg force-pushed the feature/promise.all branch from 664c2d7 to c29a1dd Compare August 22, 2025 01:01
@komyg komyg marked this pull request as ready for review August 25, 2025 11:01
@komyg komyg requested a review from aapoalas August 25, 2025 11:01
@komyg
Copy link
Contributor Author

komyg commented Aug 25, 2025

Hey @aapoalas, I've resolved your comments, and I also fixed the promise_constructor.

The code does not implement the whole spec yet, but I think it is at a good starting point.

Can you review again, please?

@aapoalas
Copy link
Member

Hey @aapoalas, I've resolved your comments, and I also fixed the promise_constructor.

The code does not implement the whole spec yet, but I think it is at a good starting point.

Can you review again, please?

Yup, looks good to me! Now it's just the spec algorithm; great work <3

@komyg komyg force-pushed the feature/promise.all branch from 3f73a5e to 95e3dad Compare September 1, 2025 12:20
@komyg komyg requested a review from aapoalas September 1, 2025 12:26
@komyg
Copy link
Contributor Author

komyg commented Sep 1, 2025

Hey @aapoalas, I've implemented the algorithm, can you review again, please?

Copy link
Member

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

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

The code mostly looks good (just one GC lifetime / use-after-free issue), but it's not exactly what the spec says the method should do. Maybe we could pair program this over the finish line?

.unbind()?
.bind(gc.nogc());

let promise_all_record = agent.heap.create(PromiseAllRecord {
Copy link
Member

Choose a reason for hiding this comment

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

issue: This PromiseAll value (which is effectively a reference to the heap) is unbound from the GC lifetime and is thus becomes use-after-free if Promise::resolve in the array loop triggers GC.

A further issue is that this method doesn't quite do what the spec says in general. The first_arg argument is supposed to be an iterable type (so eg. a Set or Map would be okay as well), with all the good and bad things that come with that. Supporting that whole all becomes a... whole thing :)

I'm wondering, would you want to pair-program this over the finish line? There's some busy-work to be done (around making the PromiseAll scopable, iterating iterators), and then the "real" work of translating the spec text. I assume that may be a bit hard to do without help, so pair programming seems like it might be a good solution.

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.

2 participants