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

Rib Robustness: Avoid Recursive algorithm of type-pull-up and use queue & stack #782

Closed
afsalthaj opened this issue Aug 20, 2024 · 2 comments
Assignees
Labels
Milestone

Comments

@afsalthaj
Copy link
Contributor

afsalthaj commented Aug 20, 2024

No description provided.

@afsalthaj afsalthaj changed the title Avoid Recursive algorithm of type-pull-up Avoid Recursive algorithm of type-pull-up and use queue & stack Aug 20, 2024
@afsalthaj
Copy link
Contributor Author

afsalthaj commented Aug 20, 2024

This is recursion currently because we bumped into Rust borrowing issues with the following efficient logic
which may require changing Expr data structure with RefCells.
Logic that we need:

  • Fill up a queue with the parent node being first
    [select_field(select_field(a, b), c), select_field(a, b), identifier(a)]
    Pop from back and push to the front of a stack of the current expression's inferred type, and keep assigning it.
    Example:
  • Pop back to get identifier(a)
  • Try to pop_front inferred_type_stack, and if its None. Push front the identifier(a)'s inferred_type: Record(b -> Record(c -> u64))
  • Pop back from stack to get select_field(a, b)
  • Try to pop_front inferred_type_stack, and its Record(b -> Record(c -> u64)). Get the type of b and assign itself and push_front to stack.
  • Pop back from stack to get select_field(select_field(a, b), c)
  • Try to pop_front inferred_type_stack, and its Record(c -> u64). Get the type of c and assign itself and push to stack.

@afsalthaj
Copy link
Contributor Author

afsalthaj commented Aug 20, 2024

@jdegoes I would like a pair up to implement this or similar in Rust without changing Expr data structure. With changing Expr to RefCell (may Rc-RefCell I can see it working though. May be there is a better way that you may have an idea.

@afsalthaj afsalthaj added the rib label Aug 20, 2024
@vigoo vigoo added this to the Golem 1.1 milestone Sep 13, 2024
@afsalthaj afsalthaj changed the title Avoid Recursive algorithm of type-pull-up and use queue & stack Rib Robustness: Avoid Recursive algorithm of type-pull-up and use queue & stack Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants