News for hackers. Stuff that matters.
Re:Steel Bank Common Lisp by jemfinch on Saturday July 01, 2023 @03:44PM (#36554263)
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.
Re:Steel Bank Common Lisp by nequo on Saturday July 01, 2023 @09:39PM (#36557305)
> 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:

  > "3" * "4"
  12
Haskell is not:

  ghci> "3" * "4"

  <interactive>:1:5: error:
      • No instance for (Num String) arising from a use of ‘*’
      • In the expression: "3" * "4"
        In an equation for ‘it’: it = "3" * "4"
Neither is OCaml:

  utop # "3" * "4";;
  Error: This expression has type string but an expression was expected of type
           int
Re:Steel Bank Common Lisp by wizzard0 on Sunday July 02, 2023 @12:26PM (#36562960)
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?

Re:Steel Bank Common Lisp by nequo on Sunday July 02, 2023 @12:57PM (#36563278)
> 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).

Re:Steel Bank Common Lisp by funcDropShadow on Monday July 03, 2023 @09:59AM (#36572957)
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.