• TrustingZebra
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    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 year ago

      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 year ago

        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 year ago

      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.