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

Stack trace for blame failures #27

Merged
merged 4 commits into from
Sep 25, 2019
Merged

Stack trace for blame failures #27

merged 4 commits into from
Sep 25, 2019

Conversation

teofr
Copy link
Contributor

@teofr teofr commented Sep 18, 2019

The basic idea of this stack trace is to provide a dynamic path of an execution leading to a Blame . This should be easily extended to other kinds of errors.

On a higher order language it's not straight forward what does it mean to call a function (or to enter a function), this approach takes as calling (entering) any time the evaluator looks up a var on the environment. But at the same time it differentiates between two different kinds of vars, let-bound or lambda-bound. I think this provides a good level of detail of what's going on.

There are some examples, here's one ( trace.ncl ):

Code:

let map = Assume((Num -> Num) -> Num, fun funky => (funky 3) + (funky false)) in
map (fun yak => yak + 1)

Output:

Evaluation didn't finished, found error:
Reached a blame label, some cast went terribly wrong
    Tag: An assume
    Line: 1 Column: 11

CallStack:
    Bounded to yak on line: 2 col: 17
    Bounded to funky on line: 1 col: 65
On a call to map on line: 2 col: 1

The basic idea is that we now can know:

Ideally, we could combine #23 and this information (the stack also has information for every application) in order to say which part violated which subcontract of the failing contract

@teofr teofr requested review from mboes and aspiwack September 18, 2019 15:56
@teofr teofr self-assigned this Sep 18, 2019
@teofr teofr force-pushed the teofr/position-for-annotated-terms branch from 1e9a495 to 26d60a8 Compare September 23, 2019 08:35
@teofr teofr force-pushed the teofr/call-stacking branch from 7c70440 to 3083d25 Compare September 23, 2019 08:42
@teofr
Copy link
Contributor Author

teofr commented Sep 23, 2019

Rebased.

@teofr teofr changed the base branch from teofr/position-for-annotated-terms to master September 23, 2019 08:43
Copy link
Member

@aspiwack aspiwack left a comment

Choose a reason for hiding this comment

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

I'm not convinced that the lambda-binder part of the trace is very relevant, to be honest. But it's not hard to remove either.

src/program.rs Outdated Show resolved Hide resolved
Co-Authored-By: Arnaud Spiwack <[email protected]>
@teofr
Copy link
Contributor Author

teofr commented Sep 25, 2019

I think the main use for lambda binders is when you use higher order functions, and specially when you combine these with anonymous functions, for example:

let map = Assume((Num -> Num) -> Num, fun funky => (funky 3) + (funky false)) in
map (fun yak => yak + 1)

Gives the following trace:

CallStack:
=========
    Bounded to yak on line: 2 col: 17
    Bounded to funky on line: 1 col: 65
On a call to map on line: 2 col: 1

Without the lambda-binder part you wouldn't know:

  • which call to funky caused a problem,
  • the fact that fun yak => yak + 1 was ever executed.

@teofr teofr merged commit 6cf0db4 into master Sep 25, 2019
@teofr teofr deleted the teofr/call-stacking branch September 25, 2019 08:45
@mboes mboes unassigned teofr Mar 20, 2020
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