Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Editorial: simplify DataView validation #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jugglinmike
Copy link
Contributor

Previously, the variable named "byteLengthChecked" could contain a
specification label ("empty") or a Number value. Despite this, it was
only used to determine whether a single condition had been satisfied.
Using a complex type to describe a binary state made the algorithm
appear more complicated than it truly is.

In addition, that variable was defined solely to determine whether the
view's byte length needed to be validated. However, the conditions
determining the necessity of this validation can be inferred from other
specification variables.

Remove the "byteLengthChecked" variable and reference the value of
"viewByteLength" to determine when to perform validation. Although this
approach will encourage unnecessary validation (specifically: whenever a
byte length has not been specified for a non-resizable buffer), that
behavior is not observable and therefore implementations are free to
skip it.


Alternatively, see gh-83

Previously, the variable named "byteLengthChecked" could contain a
specification label ("~empty~") or a Number value. Despite this, it was
only used to determine whether a single condition had been satisfied.
Using a complex type to describe a binary state made the algorithm
appear more complicated than it truly is.

In addition, that variable was defined solely to determine whether the
view's byte length needed to be validated. However, the conditions
determining the necessity of this validation can be inferred from other
specification variables.

Remove the "byteLengthChecked" variable and reference the value of
"viewByteLength" to determine when to perform validation. Although this
approach will encourage unnecessary validation (specifically: whenever a
byte length has not been specified for a non-resizable buffer), that
behavior is not observable and therefore implementations are free to
skip it.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant