Live data from Hacker News

The melancholy decline of the semicolon

unherd.com

81–90 of 260 posts

Re: The melancholy decline of the semicolon

#81
post #77

Completely off topic but, after doing python for ages, recently started writing Rust and semicolon does seems useless. We are doing the indentation and new lines anyway, why not just make them as default language construct as python does. (autodidact developer here, feel free to ELI5 and enlighten me)

Well, have you ever run into the

    x = some_long_expression
            + another_long_expression
problem? In Python you need to be careful to wrap that in () or use a \ before the newline to avoid it parsing as two lines, e.g.

    x = some_long_expression;
    + another_long_expression;

In particular, if you have a builder expressions

    let x = someBuilder()
            .setVal(x)
            .build()
You'd need to wrap the entire thing in () to avoid it getting mad, right?

So if you're going to terminate expressions with ), and start them with (, why not just terminate them with ; instead?

Javascript is a "Semicolons Optional" language, but it's actually the worst of both worlds, as you have to be very careful not to wrap lines like

    function() {
         some stuff;
         return
            really_long_named_thing;
    }
As it'll just insert a ; on the return, returning undefined for you.

Re: The melancholy decline of the semicolon

#82
post #28

Meh. Grammar, in general, is on a steep suckiness trend. For example, when was the last time you saw someone on the web actually use the correct past tense of "lead (verb, transitive)"?

What is the correct past tense of lead? I thought it was “led”, but I can’t remember having ever read any other form? What often irks me, as a non-native speaker, is the wrong subjunctive (if that’s what it’s called). People say and write all the time “I wish you were there”, when they mean “I wish you had been there”. At least I’m pretty sure that’s how it’s supposed to be…

> I thought it was “led”

It is "led". I notice the web using "lead" for both the present and past forms a lot--presumably because it sneaks past spelling checkers and autocorrect. (There's also a correspondence to "read" (long e) where "read" (short e) is also the past tense. Yeah, welcome to English.)

And, I'm almost sorry for pointing it out if you haven't noticed it. Once you do notice it, you see it everywhere and it's a big, jarring speedbump when you read.

Re: The melancholy decline of the semicolon

#83
post #54
post #28

Meh. Grammar, in general, is on a steep suckiness trend. For example, when was the last time you saw someone on the web actually use the correct past tense of "lead (verb, transitive)"?

https://news.ycombinator.com/item?id=29274875#29276377 8 days ago, 3 times.

Erm, at least one of those is unusually wrong:

"The doors are not always hidden - they clearly separate these two worlds, and may also led to very nice places that are just not public."

Presumably a typo.

Re: The melancholy decline of the semicolon

#84
post #77

Completely off topic but, after doing python for ages, recently started writing Rust and semicolon does seems useless. We are doing the indentation and new lines anyway, why not just make them as default language construct as python does. (autodidact developer here, feel free to ELI5 and enlighten me)

Because then there'd be ambiguity between a function ending and returning unit (nothing) or returning whatever the last line expression returns. You could change things around this, but Rust has a goal of unambiguous syntax, hence also the turbofish::

Re: The melancholy decline of the semicolon

#85
post #77

Completely off topic but, after doing python for ages, recently started writing Rust and semicolon does seems useless. We are doing the indentation and new lines anyway, why not just make them as default language construct as python does. (autodidact developer here, feel free to ELI5 and enlighten me)

Rust uses the semicolon to distinguish between statements and expressions.

Re: The melancholy decline of the semicolon

#86
post #77

Completely off topic but, after doing python for ages, recently started writing Rust and semicolon does seems useless. We are doing the indentation and new lines anyway, why not just make them as default language construct as python does. (autodidact developer here, feel free to ELI5 and enlighten me)

It's a lot easier to format code arbitrarily when a language is whitespace-independent.

For example, to do method chaining across multiple lines, Python requires parentheses around the whole chain. That's a quirk of being a whitespace-dependent language.

In general, I think people who advocate for braces and semicolons just find it easier to reason about the code when they know that the formatting doesn't matter. All the flow is done via visible glyphs.

Re: The melancholy decline of the semicolon

#89
post #77

Completely off topic but, after doing python for ages, recently started writing Rust and semicolon does seems useless. We are doing the indentation and new lines anyway, why not just make them as default language construct as python does. (autodidact developer here, feel free to ELI5 and enlighten me)

It's a trade-off. You can either assume all statements end at the end of the line, and require a continuation character (backslash in Python) if that isn't the case; or you can require a statement terminator (semicolon/closing brace in Rust) for all statements.

The downside of assuming statements end at the end of the line is that you need to have special rules for when that isn't the case (such as Python's implicit statement continuation inside braces), while always having a terminator is simpler and more consistent (all statements end with a semicolon) at the cost of extra characters.

Re: The melancholy decline of the semicolon

#90
post #26

This article does not demonstrate understanding of the semicolon; it is used incorrectly in the first sentence, for crying out loud.

It uses the semi-colon to join independent clauses instead of a conjunction, which is fine. It might otherwise have read, “The semicolon is a profound public mystery, and the only punctuation mark that…”. Nevertheless, it isn’t a great showcase for the semi-colon’s usefulness. The writer could have invented a more elegant example to begin the article; the one they chose is a prime example of a semi-colon that adds little to the sentence.
Post reply on HN