- cross-posted to:
- programmer_humor@programming.dev
- programminghumor@lemmy.world
- cross-posted to:
- programmer_humor@programming.dev
- programminghumor@lemmy.world
Made with KolourPaint and screenshots from Kate (with the GitHub theme).
Made with KolourPaint and screenshots from Kate (with the GitHub theme).
Because
let x: y
is syntactically unambiguous, but you need to know thaty
names a type in order to correctly parsey x
. (Or at least that’s the case in C wherea(b)
may be a variable declaration or a function call depending on what typedefs are in scope.)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.
I think he means that of you initialize the variables, it becomes simpler but still unambiguous
Also useful when the types are optional, like Python. Though they don’t use any
let
orvar
or anything so maybe throw that entire point out the window