• jdeath
    link
    fedilink
    arrow-up
    10
    arrow-down
    2
    ·
    1 year ago

    i like when my strongly typed language can type itself, why should i have to type extra words because the compiler is stupid?

    • Wats0ns@sh.itjust.worksOP
      link
      fedilink
      arrow-up
      17
      arrow-down
      1
      ·
      edit-2
      1 year ago

      So that next time your coworker uses the wrong type, the compiler can scream at him: “NO I WONT COMPILE THIS YOU DUMBASS, LOOK JOHN SAID ON LINE 863 THAT IT SHOULD BE A DOUBLE, NOT A FLOAT FOR FUCK SAKE”

      • jdeath
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        you can still have that without having to declare the type manually. check out Swift or OCaml for example

      • Gecko@lemmy.world
        link
        fedilink
        English
        arrow-up
        18
        arrow-down
        1
        ·
        1 year ago

        Type error unless there’s an implementation of + that specifies adding together and integer and a string.

      • sweeny@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        arrow-down
        1
        ·
        edit-2
        1 year ago

        I’m not sure if you’re being rhetorical or not, but “string|number” is definitely correct here. A computer could definitely figure this out, but typing is for the benefit of the coders more than the code itself. It’s basically functional documentation

          • sweeny@sh.itjust.works
            link
            fedilink
            arrow-up
            1
            arrow-down
            1
            ·
            1 year ago

            Yeah that’s what I’m saying, I hate it when coworkers will assign everything as “any” just to avoid the scary red squigglies. Oh well I guess that’s what code reviews are for 🙃