• r1veRRR@feddit.de
    link
    fedilink
    arrow-up
    55
    ·
    1 year ago

    Compiler checked typing is strictly superior to dynamic typing. Any criticism of it is either ignorance, only applicable to older languages or a temporarily missing feature from the current languages.

    Using dynamic languages is understandable for a lot of language “external” reasons, just that I really feel like there’s no good argument for it.

    • SpaceCowboy@lemmy.ca
      link
      fedilink
      arrow-up
      8
      ·
      1 year ago

      Yeah the error list is my friend. Typos, assigning something to the wrong thing or whatever is fixed without having to run the code to test it. Just check the error list and fix any dumb mistakes I made before even running the thing. And I can be confident in re-factoring, because renaming something is either going to work or give a compiler error, not some run-time error which might happen in production weeks later.

    • flakusha@beehaw.org
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Dynamic languages are good for prototyping, especially if a lot of libraries available

    • kaba0@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      I do believe that static typing is at least a local optimum, but I am still not entirely convinced. Rich Hickey is a very convincing presenter and I can’t help but think that he is on to something — with Clojure the chosen direction is contract-typing, which is basically a set of pre- and post-conditions for your functions that are evaluated at runtime. Sure, it has a cost and in the extremes they are pretty much the same as dependent types, but I think it is an interesting direction — why should my function be overly strict in accepting a “record” of only these fields?