Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

does operator overloading turn c++ and others into the weakly typed language?

does typescript-like type checking (which barks on 1+”1”) with “disallow emit on error” turn javascript into the strongly typed one?



> does operator overloading turn c++ and others into the weakly typed language?

Polymorphism is not the same as implicit type conversion. For example, in Haskell, `*` is defined for both integers and doubles so 3 * 4 and 3.0 * 4.0 both work without type conversion. But JavaScript converts strings to numbers in "3" * "4".

> does typescript-like type checking (which barks on 1+”1”) with “disallow emit on error” turn javascript into the strongly typed one?

I think so. And this is not surprising. TypeScript is a different language from JavaScript (even if it’s a superset of it).


Pointer arithmetic pulls C and C++ into the realm of weakly typed languages. Pointer arithmetic is a core part of the language.

On the other hand, Haskell's unsafeCoerce or OCaml Obj.magic are usually not considered to be part of the language, since they are "normal" functions, but it is impossible to implement them inside the language.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: