Open ljharb opened 2 years ago
I raised the similar issue in original proposal: https://github.com/tc39/proposal-record-tuple/issues/327
Here are the names I suggested: parsePrimitive
or parseAsPrimitive
“Primitive” includes things that JSON doesn’t - symbols and undefined, in particular.
@ljharb Yeah, and JSON also don't include bigints and special float values (NaN, ±Infinity). But I think it's still correct to say it only generate primitives?
Well, there is another option, JSON.parseConst
. Since the value cannot be changed, it is effectively constant.
const
in JS only has the connotation of "constant reference", which isn't the same as "immutable".
What about something like JSON.parseStatic
or JSON.parseFinal
?
what's dynamic or non-final about the existing parsing?
I think the word "immutable" is sufficiently overloaded that it'd cause confusion to use it.
All primitives are immutable, but so are frozen objects without internal slots that have no "non-immutable object" properties.
I'd love to gather suggestions of alternate names that can convey "produces Records and Tuples instead of Objects and Arrays" in a way that doesn't have nuances and edge cases. (I'll make my own suggestions in independent comments, as I come up with them, so they can be emoji-reacted to individually)