Made with KolourPaint and screenshots from Kate (with the GitHub theme).

  • Because let x: y is syntactically unambiguous, but you need to know that y names a type in order to correctly parse y x. (Or at least that’s the case in C where a(b) may be a variable declaration or a function call depending on what typedefs are in scope.)

    • HiddenLayer555@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      6
      arrow-down
      1
      ·
      edit-2
      6 hours ago

      Can’t say I’ve ever experienced this kind of confusion in Java but that’s probably because they intentionally restricted the syntax so there’s no ambiguity.

    • Gamma@beehaw.org
      cake
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      6 hours ago

      Also useful when the types are optional, like Python. Though they don’t use any let or var or anything so maybe throw that entire point out the window