|
|
|
|
|
by jemfinch
1076 days ago
|
|
You're issuing a correction for your original post, then? Haskell can circumvent the type system with unsafeCoerce and cast anything into anything else, therefore it (by your definition) is weakly typed. Same thing with Ocaml and Obj.magic. Practically every strongly typed language has a mechanism for circumventing the type system: C: (type) casts
C++: reinterpret_cast and friends
Haskell: unsafeCoerce
Ocaml: Obj.magic
Golang: unsafe.Pointer
Rust: std::mem::transmute
SML: MLton doesn't provide one, but SML/NJ provides
Unsafe.cast. So I guess MLton's flavor of SML
is strongly typed, but SML/NJ's is weakly typed.
Any definition of "weakly typed" which excludes Haskell and Ocaml is farcical, inaccurate, and doesn't benefit any software engineer, especially the professional ones. |
|
Here is a definition: a language is weakly typed if and only if it has implicit type conversion. JavaScript is weakly typed:
Haskell is not: Neither is OCaml: C++ is weakly typed: which prints Haskell and OCaml are not weakly typed: