tc39 / proposal-ecmascript-sharedmem

Shared memory and atomics for ECMAscript
Mozilla Public License 2.0
375 stars 32 forks source link

Use ToIndex instead of ToInteger #160

Closed evilpie closed 7 years ago

evilpie commented 7 years ago

I think we want to switch everything new to ToIndex instead of ToInteger. This affects at least ValidateAtomicAccess.

lars-t-hansen commented 7 years ago

I'm won't have a chance to investigate fully until next week, but the reason the spec is currently using ToInteger and not ToIndex is deliberately to be compatible in behavior with other parts of the spec instead of confusingly incompatible. Whether that is right or not is probably a matter for the committee at this point. (I'll try to figure out what it is that it was supposed to be compatible with.)

lars-t-hansen commented 7 years ago

It appears that the current proposal language is modeled on an older version of GetViewValue, which has since been changed to use ToIndex. I don't think there's any reason not to change the proposal to follow that change, as Tom says. Given the structure of the proposal text the only change should be in ValidateAtomicAccess, where steps 2-4 are replaced by a call to ToIndex and step 6 does not need to test for negative values.

lars-t-hansen commented 7 years ago

@syg @bterlson, please weigh in on this issue ASAP.

lars-t-hansen commented 7 years ago

Not fixed in ecma262.

lars-t-hansen commented 7 years ago

Moved to https://github.com/tc39/ecma262/issues/807