Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Convert ensure_answer_recursively to be iterative instead of recursive #281
Basically all of
Right now, a lot of code has not been moved into separate functions, but I'm definitely working on this. All in all, it's a bit more LOC, but I've also added in a lot of documentation/comments to help follow what's happening.
nikomatsakis left a comment
Initial round of review comments :) Didn't through the whole PR yet.
This is probably a good idea, but I'm taking a bit of time to get used to it.
As an aside, I wish we had better performance information. We're not at the point where we can even measure such things for real. I suppose we should be optimizing for cleanest code right now more than anything.
Before this is merged I need to rebase to
@nikomatsakis Ok, I've reverted most of the changes from the
… work we do. When a cyclic strand is encountered, immediately push it back onto the table (while tracking the work timestamp). Only take strands that are less than our time.
Make push_answer panic if previous answer had same substs, but was ambiguous whereas current answer isn't. This is needed because logic upstream assumes that returning true from push_answer is a *new* answer.
…instead inlines the checks at the two sites where it's used. (Really one and a half, since for the initial_table/answer, it can't even be cyclic.) Separated out the on_positive_cycle and on_coinductive_cycle logic to separate functions. This just makes it easier to reason about what is happening and why.
The old name didn't sound like something which had side-effects. Not sure if the new name is that much better, but at least it sounds side-effect-y to me.
This was confusing to me because `vec.pop()` returns the popped item, but `stack.pop()` was returning the top-most element.
I'm shooting for a style that is separating out the comment a bit more from the code, since I was finding it a bit hard to get the "high-level picture" at present.