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

bug with copy-on-write when a function fails #97

Open
tangentstorm opened this issue Oct 4, 2021 · 0 comments
Open

bug with copy-on-write when a function fails #97

tangentstorm opened this issue Oct 4, 2021 · 0 comments

Comments

@tangentstorm
Copy link

tangentstorm commented Oct 4, 2021

in iKe, while triggering the bug described in #96, there is a second bug that I noticed having to do with copy-on-write when i tried to make a backup of the original array that was being amended:

assert:{[err;t] $[&/t;1;err[]]}
isFlat:~|/0=@:'  / x contains no lists

a: 1 1 1 1
t: `
tick:{
  assert[`flat0; isFlat a]
  t::a  / `t` should be a copy of `a` *before* the assignment,
  / but if you inspect it, `t` is `a` *after* the following assignment:
  a[,1]::,0
  assert[`flat1; isFlat a]}

draw:{}

Note that isFlat a fails on the second run, so the assignment t::a only executes once. (Either it is constructing a view (rather than doing a global assignment), or there is something wrong with copy-on-write.

The workaround was to say t::(),a instead.

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

No branches or pull requests

1 participant