Skip to content

Let the block of Fbe.repeatedly read back what it wrote in the same run - #1332

Open
Thayorns wants to merge 1 commit into
zerocracy:masterfrom
Thayorns:1246
Open

Thayorns wants to merge 1 commit into
zerocracy:masterfrom
Thayorns:1246

Conversation

@Thayorns

Copy link
Copy Markdown
Contributor

The object that Fbe.repeatedly yields sent every write to a private Hash and every read to the stored marker, so the block could not read back a property it had just set. On the first run the read raised, and since the block failed, when was never written and every later run failed the same way; on a later run the read returned the value of the previous run.

A read now looks at what the block has written in this run first and returns its first value, the way a fact answers a getter. Only when the block has not written that property does the read go to the stored marker, so a property kept from the previous run is still visible.

Three tests read through the proxy: right after writing on the first run, right after writing on a later run, and a property written only in the previous run.

Fbe.repeatedly was already at 49.7 of the 50 allowed by Metrics/AbcSize, and the read needs a lookup and a fallback, so the method now carries # rubocop:disable Metrics/AbcSize, as Fbe.fb, Fbe.overwrite and Fbe.pmp do.

Closes #1246

@Thayorns

Copy link
Copy Markdown
Contributor Author

@yegor256 take a look please, happy to clarify anything about the change.

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.

Fbe.repeatedly yields a fact that can't read back what the block just wrote to it

1 participant