• xmunk@sh.itjust.works
    link
    fedilink
    arrow-up
    3
    ·
    8 months ago

    I may just be an old country lawyer PHP developer… but don’t most dynamic languages also support static type checking and general analysis at this point?

    • Solemarc@lemmy.world
      link
      fedilink
      arrow-up
      11
      ·
      8 months ago

      Yes but no. Modern PHP lets you put types in function signatures and it will then attempt to convert your inputs to those types at runtime.

      JS/TS and Python don’t do this. They have optional type annotations that’s treated as syntactic sugar. You can use static checkers against this but if you get an error like “expected string got int” you can still run the code. It won’t behave any differently because you have annotations.

    • tatterdemalion@programming.dev
      link
      fedilink
      arrow-up
      9
      ·
      8 months ago

      Yes if you use type annotations. Languages like Python and Typescript end up resorting to “Any” types a lot of the time, which breaks any kind of theorem proving you might have otherwise benefited from.

      • xmunk@sh.itjust.works
        link
        fedilink
        arrow-up
        6
        arrow-down
        2
        ·
        8 months ago

        I know Java developers that are addicted to Object. Hit them over the head with an ensmarttening stick and reject their PRs.

        • tzrlk@lemmy.world
          link
          fedilink
          arrow-up
          7
          ·
          8 months ago

          Java developers aren’t allowed to not know better by this point. If they think skipping types is somehow ideologically purer, keep hitting with that stick until you hit deckplate.