-
Notifications
You must be signed in to change notification settings - Fork 43
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
WIP: share the stack with JuliaInterpreter and add support for breakpoints #41
Conversation
The alternative, of having JuliaInterpreter use |
In some situations, not having the top-level frame be "special" (and just have it be the top frame in the stack) makes things a bit easier. However, I would think a linked list of frames for the stack might be an even easier structure to handle, since the random access of a Vector is seldom useful. Might be too intrusive to change at this point though. |
state.stack[end].last_exception[] = exc | ||
return true | ||
end | ||
original_stack = copy(state.stack) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example here, just being able to store original_frame = stack.frame
and then restore stack.frame = original_frame
would be nice, instead of having to both store the frame and the stack to restore the original state.
It's worth considering; you have a good point with regards to the cleanliness of the API. If I'm thinking about this clearly, the caller would have to hold the "root," meaning the top-level caller; otherwise if an error gets thrown deeper in the stack, there is no way to propagate the state back to the caller. Would you have to traverse the whole list to do anything? Or would each recursive call pass only the immediate parent? I guess you must be intending a doubly-linked list? Otherwise you have to choose between performance (avoiding the need for routine whole-stack traversal) and the ability to print the whole stack for debugging purposes (e.g., those two commented lines at the top of A related question: if we go that route, how do you signal intent for the behavior of recursive calls? Currently we can pass I'm willing to help implement this, but let's discuss a little more first. |
Yes, I was thinking double linked.
Yes, getting this right is important since it will shape the API and the convenience in using the interpreter significantly. An argument against the linked list is that it gives more power to the frame that it doesn't really need. If you see a function |
If you wanted that clarity, a design like this:
would allow you to pass In addition to
|
No description provided.