5 ms·
But why not use a single character? With the double colon, something like foo::bar(xyz) looks like bar is “closer” to xyz, when in fact it's closer to foo.
by xigoi 5y ago
But why not use a single character? With the double colon, something like foo::bar(xyz) looks like bar is “closer” to xyz, when in fact it's closer to foo.
- torresjrjr 5y agoA 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.
- xigoi 5y agoA different character could be used, such as # (like in VimScript) or \ (like in… PHP?)
- torresjrjr 5y agoTrue, but :: is probably more readable than # or \ Design a language, and you'll understand that there's always trade-offs.
- xigoi 5y agoI personally find :: very unreadable, for the very reason I mentioned.