Skip to content

Commit 5d46819

Browse files
committed
types-grammar, ch4: starting 'type awareness' discussion
1 parent a2a32fa commit 5d46819

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

types-grammar/ch4.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,18 @@ Let me make something absolutely clear, though: none of this is `==`'s fault. It
14561456
14571457
## Type Awareness
14581458
1459+
We've sliced up and examined coercion from every conceivable angle, starting from the abstract internals of the specification, moving to the concrete expressions and statements that actually trigger the coercions.
1460+
1461+
But what's the point of all this? Is the detail in this chapter, and indeed this whole book up to this point, mostly just trivia? I don't think so.
1462+
1463+
Let's return to the observations/questions I posed way back at the beginning of this long chapter.
1464+
1465+
There's no shortage of opinions (especially negative) about coercion. The nearly universally held position is that coercion is mostly/entirely a *bad part* of JS's language design. But inspite of that reality, most every developer, in most every JS program ever written, faces the reality that coercion cannot be avoided.
1466+
1467+
In other words, no matter what you do, you won't be able to get away from the need to be aware of, understand, and manage JS's value-types and the conversions them.
1468+
1469+
Surely you're thinking at this moment: "Why can't I just use TypeScript and make all my types static, avoiding all the confusion of dynamic typing and coercion?"
1470+
14591471
// TODO
14601472

14611473
[^EichCoercion]: "The State of JavaScript - Brendan Eich", comment thread, Hacker News; Oct 9 2012; https://news.ycombinator.com/item?id=4632704 ; Accessed August 2022

0 commit comments

Comments
 (0)