this post was submitted on 19 Jun 2025
47 points (87.3% liked)
Programmer Humor
36575 readers
333 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.
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