• Marmotte
    link
    fedilink
    arrow-up
    109
    arrow-down
    2
    ·
    2 days ago

    Already exists, that’s called Javascript

    • 𝕱𝖎𝖗𝖊𝖜𝖎𝖙𝖈𝖍@lemmy.world
      link
      fedilink
      arrow-up
      27
      arrow-down
      1
      ·
      2 days ago

      Unlike traditional types such as string, number, or even JavaScript’s dangerously permissive any, an ambiguous variable can contain any value, several values, or no value at all, depending on execution context, compiler mood, and whether anyone is currently debugging it.

      It’s different than loosely typed vars, which are not at all exclusive to Javascript

      • bitfucker@programming.dev
        link
        fedilink
        arrow-up
        7
        ·
        1 day ago

        “any value, several, or no value”. Any in JS is literally that tho, sans “Never” iirc

        Edit: oops, I was wrong. Any MAY be a never. Typescript allows it