Sketch out full extent of Value variants #100
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried sketching out all Value "enum-space" variants that I could squeeze out of the ECMAScript spec. Some of these I'm not even sure if they're truly possible, mainly the generator functions vs iterators I'm not sure if they're the same thing or not. (
AsyncFromSyncIterator
is explicitly mentioned to not be observable by user code.)Anyway, the end result was that with this absolutely bloated selection of variants we have a total of 56 different Value variants, an equal amount of thrown variants of course, 0 for None and 0x80 for ReferenceRecord. With a u8 repr we can afford 127 Value variants in total if we have thrown variants as well, so this would be 44.5% of the way to us being full. Put another way, we have 71 variants open. This number can be increased by eg. combining primitive value objects into a single variant, combining TypedArrays into a single variant, combining functions into less variants (it's very much debatable if all the different versions are all that useful). That would give us about 20 more variants.
So anyway, does this spark any ideas? Anything I've missed? Something that obviously doesn't make sense?