• dan@upvote.au
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    5 months ago

    Use TypeScript, and nonsensical things like adding arrays to objects will be compile-time errors.

    • Schadrach@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 months ago

      By that logic what we really need is a modernization of Ada, where there are no compiler warnings and anything that would generate one in another language is instead a compiler error, everything is strongly typed, etc, etc.

      If you aren’t familiar with Ada, just imagine Pascal went to military school.

  • Mesa@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    4 months ago

    I’m in this no-experience-to-apprenticeship program and everyone in my class thinks type coercion is the greatest thing ever.

    • Ethan@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      5 months ago

      Sure. But in a sane language doing something totally nonsensical like that is an error, and in a statically typed language it’s a compiler error. It doesn’t just silently do weird shit.

        • Lime66@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          4 months ago

          Any of them which are still strongly typed. Just because a language doesn’t check for type errors before runtime doesn’t mean it won’t check at all