4 ms·
Periods are in struct.member identifiers and also in floating points. Using them again for end of statement would be complicated[1]. Imagine that your statemen
by adhesive_wombat 4y ago
Periods are in struct.member identifiers and also in floating points. Using them again for end of statement would be complicated[1].
Imagine that your statements are "x = y.x = z." The compiler needs to figure out if that middle dot is saying "x member of y" or if it's a statement terminator.
[1]: It's already complicated by that reuse, which is, I assume, why identifiers can't start with digits so your parser can be simpler.
- xigoi 4y agoI assume that the statement terminator was chosen first, so they could've used something else for member access, such as `\`. Though I don't know about floats.
- yissp 4y agoThey could have used a comma for floats, as is common in many non-English-speaking countries. Although I guess that might become ambiguous with its use as a parameter separator.