• TrustingZebra
    link
    fedilink
    arrow-up
    4
    ·
    1 年前

    How is dynamic typinf faster? Is typing num = 1 instead of int num = 1 really that much faster?

    • GaveUp [she/her]@hexbear.net
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      1 年前

      It’s not just the physical typing

      It’s the fact that you can be extremely flexible with data structures and variables

      E.g. you can have a list of strings and ints in Python but not java

      • morrowind@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        1 年前

        This is why union types are great (also sum types are similar I think, never used those)

    • colonial@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 年前

      Plus, most statically typed languages either do type inference by default or let you opt in somehow.

      Even Java, which is probably the reason everyone hated static typing for the first decade of the century or so, now has var.