News for hackers. Stuff that matters.
Re:Vala Programming Language by xigoi on Saturday July 16, 2022 @05:08AM (#32116358)
>Rob Pike famously explained that C needed its space-insensitive braces and semicolons in case code was transmitted through a channel that mangled whitespace.

But did he explain why it used semicolons, rather than periods, which would make more sense because a statement is basically a sentence?

Re:Vala Programming Language by int_19h on Saturday July 16, 2022 @05:27AM (#32116436)
Semicolons as statement terminator (or separator) are at least as old as Algol-60; C merely inherited that.
Re:Vala Programming Language by adhesive_wombat on Saturday July 16, 2022 @08:44AM (#32117475)
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.

Re:Vala Programming Language by xigoi on Saturday July 16, 2022 @09:14AM (#32117693)
I 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.
Re:Vala Programming Language by yissp on Saturday July 16, 2022 @09:51AM (#32118077)
They 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.
Re:Vala Programming Language by lfnoise on Saturday July 16, 2022 @12:18PM (#32119465)
Smalltalk uses periods. One thing I like about C is that I can write .1 or 1. , but most languages these days force me to add the zero: 0.1 or 1.0 .
Re:Vala Programming Language by dukoid on Saturday July 16, 2022 @09:30AM (#32117863)
Probably because periods are used in numbers already...

print 42.0