Transcript from the "Introducing Types and Coercion" Lesson
[00:00:38] The real difference is what is typed. In a statically typed language which language is like C++ and Java they fall under that umbrella of statically typed. In a statically typed language we refer to a type as a description for what can go in a variable. In other words the variable itself is typed.
[00:00:59] In dynamic languages, there are still types but we don't focus on the variable, the container having a type. We focus on the value itself, having the type. So, we think about them as value types as opposed to container types. Now, people will disagree on the usage of the word type and you shouldn't call it that, whatever.
[00:01:42] That's it. Given the value 42, there are behaviors that we can expect. We can expect that we can do math on it. We can expect that we can add, subtract, multiply and divide that number. We can format it to have different number representations like in base 10 or base 16.
[00:02:00] We can expect to do specific things with that number. The value quote 42 on the other hand, while visually they look almost the same, that value has a different set of expectations. Those expectations are well we can access the individual characters. We can do input output with it like print it to the console or add it to a DOM element.
[00:03:23] And then when he showed up they're like no no no that's crazy. We're not going to put schema in the browser. Anybody ever had that before? They tell you one thing on the job interview than on the job. [CROSSTALK]
>> Speaker 2: Job was getting hard, right?
[00:03:42] that would be crazy to put like a Java plugin in a browser. Make it look like Java then, don't make it look like scheme because that's just academic program. So there's a lot that was added to the language, affordances, if you will, to try to make it look more like that.
>> Kyle Simpson: It appears on the surface syntactically to be more from the C family of programming languages because we have curly braces and semicolons, everybody's favorite syntactic affordances, right?
[00:04:41] I really wanna dig into coercion and I want you to understand more about how this is and how it works, and why it's not actually a negative of the language. Coercion is actually a very necessary part of the programming language. And I wanna give you a frame of reference or a different way of thinking about it that suggests that it's something that we actually should embrace in our code.
[00:05:06] And that will lead us into a discussion of equality which is the most common of the misunderstood parts of the types system and the coercion system. How coercion interplays with equality checks