Pin Specifiers are passed to IO constructors:
new Digital({pin: 1, mode: Digital.Input});
During development of ECMA-419 2nd Edition, it was observed that when the pin is undefined -- often because the user accidentally left out the pin property -- that pin 0 was used. This is because undefined becomes 0 when coerced to a number. Using pin 0 is entirely unexpected.
The Moddable SDK implementation of ECMA-419 IO was updated to throw on a value of undefined for a pin specifier. This is not currently reflected in the specification. I think we should update this for 3rd Edition.
There are likely other cases where undefined should be rejected as a value, such as Port Specifiers and mode.
Pin Specifiers are passed to IO constructors:
During development of ECMA-419 2nd Edition, it was observed that when the pin is
undefined-- often because the user accidentally left out the pin property -- that pin 0 was used. This is becauseundefinedbecomes0when coerced to a number. Using pin0is entirely unexpected.The Moddable SDK implementation of ECMA-419 IO was updated to throw on a value of
undefinedfor a pin specifier. This is not currently reflected in the specification. I think we should update this for 3rd Edition.There are likely other cases where
undefinedshould be rejected as a value, such as Port Specifiers andmode.