News for hackers. Stuff that matters.
Re:Untyped Programs Don’t Exist by Guthur on Friday December 07, 2018 @04:24AM (#18626207)
Pretty sure javascript is weakly typed.
Re:Untyped Programs Don’t Exist by tom_mellior on Friday December 07, 2018 @04:59AM (#18626352)
Can you show an example of a JavaScript type error that is not detected at any point? By "type error" I mean something like "applying integer add to a bit pattern representing an integer and a bit pattern representing a float", which you can do in assembly language or Forth or C, but not in any dynamically typed language I know of. Because you cannot take the bits that make up a float and pretend to the compiler that those bits actually represent an integer.
Re:Untyped Programs Don’t Exist by leshow on Friday December 07, 2018 @11:06AM (#18628766)
weak/strong typing has no formal definition. You can argue over it's meaning but neither of you will be right.
Re:Untyped Programs Don’t Exist by gugagore on Friday December 07, 2018 @10:52AM (#18628638)
I have heard that languages like javascript are weakly typed because of the effort they go through to evaluate an expression instead of throwing a type error.

>> "5" - 3 < 2

It doesn't fit your example of a type error. Quite the opposite, the interpreter intentionally has code to do the specific thing for the specific types. But this feature is why javascript is "weakly typed" in many posts.