Y
Hacker News
new
|
ask
|
show
|
jobs
by
torresjrjr
1519 days ago
A single ':' is used for other things, like casting types.
let x: int = 0;
It's so that the compiler can distinguish between those two, and likely some other areas too.
1 comments
xigoi
1519 days ago
A different character could be used, such as # (like in VimScript) or \ (like in… PHP?)
link
torresjrjr
1519 days ago
True, but :: is probably more readable than # or \ Design a language, and you'll understand that there's always trade-offs.
link
xigoi
1519 days ago
I personally find :: very unreadable, for the very reason I mentioned.
link