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

Record mutated variables / objects that might be mutated by a unknown loop or function call #60

Open
kaleidawave opened this issue Sep 13, 2023 · 1 comment
Assignees
Labels
checking Issues around checking
Milestone

Comments

@kaleidawave
Copy link
Owner

Given something like

function (cb: Function) {
    const obj = { a: 2 }
    cb(obj)
    console.log(obj.a)
}

This might fail if the function passed as cb deletes a from obj.

As there is no annotation syntax for marking a function as pure/without side effects (at the moment 👀) the safety isn't known inside the function.

This currently isn't caught in Ezno, so needs fixing.

Instead:

  • Objects passed to functions (and some other items that might be mutated by calling a unknown function) must be marked as unstable or something
  • Using this unstable poly types should require checking in apply_effect (as it evaluates side effects and is aware of what stage the function is at)
@kaleidawave kaleidawave added the checking Issues around checking label Sep 13, 2023
@kaleidawave kaleidawave self-assigned this Sep 13, 2023
@kaleidawave kaleidawave added this to the 0.1.0 milestone Nov 1, 2023
@kaleidawave kaleidawave changed the title Record possibly mutated variables / objects and do checking in effects Record mutated variables / objects that might be mutated by a unknown loop or function call Dec 14, 2023
@kaleidawave
Copy link
Owner Author

#95 starts on this might need to identify the edge cases but the basic principal is there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checking Issues around checking
Projects
None yet
Development

No branches or pull requests

1 participant