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

Preventing Unstable Edits #16

Open
pascallouisperez opened this issue Dec 8, 2017 · 0 comments
Open

Preventing Unstable Edits #16

pascallouisperez opened this issue Dec 8, 2017 · 0 comments
Milestone

Comments

@pascallouisperez
Copy link
Contributor

(Copied from README.)

Assume we have the worksheet

worksheet cyclic_edits {
	1:right bool
	2:wrong computed {
		return !right
	}
}

And we propose the edit ws.right = false. Due to the computed field, this would yield 'actual edit #1'

ws.right = false
ws.wrong = true

Now, assume that we have edit reacting code which flips these fields around

if wrong {
	right = true
} else {
	right = false
}

We would then yield the 'actual edit #2'

right = true
wrong = true

And, due to the computed field, this would yield 'actual edit #3'

right = true
wrong = false

Further modified via the event reacting code into 'actual edit #4'

right = false
wrong = false

And again, due to the computed field, this would yield 'actual edit #5'

right = false
wrong = true

Which is in fact the same as 'actual edit #1'. We have created an infinite loop in the fixed-point calculation!

To prevent such 'unstable edits', we detect cycles of edits, and error out, hence rejecting the proposed edit as being invalid. (Implementation note: this must be done by comparing worksheets', not edits, since two different edits can yield the same worksheet transformation.)

@pascallouisperez pascallouisperez added this to the 0.3 milestone Dec 8, 2017
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