03:06 | <sideshowbarker> | Looking at https://github.com/mdn/content/issues/15129 — in general in MDN articles where we’re describing a case where some JavaScript data type gets coerced into another data type, any recommendations on what term we should use? “an x gets cast to a y”, or “an x gets converted to a y”, or “an x gets coerced into a y”? or what? (this particular case is about the delay parameter of setTimeout() being coerced into a number) |
03:07 | <bakkot> | "coerced" is the term I personally use |
03:07 | <jmdyck> | The spec doesn't use the verb "cast" at all. |
03:08 | <bakkot> | this is also the word used in at least some education materials, looks like |
03:08 | <sideshowbarker> | The spec doesn't use the verb "cast" at all. |
03:09 | <bakkot> | e.g. https://eloquentjavascript.net/01_values.html
|
03:09 | <jmdyck> | It does use "coerce" some, but it uses "convert/conversion" a lot more. |
03:09 | <bakkot> | though that's in a section called "automatic type conversion", not "... coercion", so somewhat inconsistent |
03:10 | <bakkot> | also e.g. https://exploringjs.com/impatient-js/ch_values.html#coercion-automatic-conversion-between-types |
03:10 | <sideshowbarker> | OK, I see now we actually have https://developer.mozilla.org/en-US/docs/Glossary/Type_coercion in MDN |
03:11 | <sideshowbarker> |
|
03:12 | <jmdyck> | So if a particular case is implicit, how are you supposed to decide if it's coercion or conversion? |
03:13 | <sideshowbarker> | dunno… |
03:16 | <jmdyck> | Hm, some of the spec's uses of "coerce" are not implicit. e.g. "A String object can be coerced to a String value by calling the String constructor as a function" |
03:18 | <jmdyck> | I think the spec is using "coerce" and "convert" interchangeably. |
03:57 | <sideshowbarker> | They’re likely used interchangeably in MDN articles as well — I doubt most MDN contributors make the distinction |