• marcos@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    Dynamically typed doesn’t imply it’s monotyped. And monotyped languages can work just fine, you just have to not hide different operations under the same symbols just differing by type like JS does.

    The entire problem with JS is that it both is monotyped and it isn’t.

    • Pipoca@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Isn’t the whole point of dynamic languages that they’re monotyped? They’re equivalent to a type system with only one type, any. Really, most dynamic languages are equivalent to having a single tagged union of all the different sorts of values in the language.

      If you add additional types, you get into gradual type systems.

      • marcos@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        A language has dynamic types if the type-resolution is done at runtime. The other kind is static types, where it’s done at compile-time.

        A language is monotyped if every value is compatible with every operation, so there’s actually no type resolution.

        A language has explicit types if you declare your types, implicit ones if you can’t declare them, type derivation if declarations are optional but they exist and are static you declaring or not, or gradual types if declarations are optional but they exist and are dynamic you declaring them or not.

        All of those things are different.

        Also, some people will insist “types” can only be static. Go ask those people whatever is the name of the things Python have, because either they just invented some different words, or they are only trying to confuse you.