Hacker News new | past | comments | ask | show | jobs | submit login

he meant making the (a) part optional to make "if a" instead. parenthesis are (), {} are braces :)



One of the few times I get to remember that English is only my second language. Can't really think of a reason for not dropping them unless there is a weird corner case in the existing grammar.


If you dropped the parentheses around the condition, I think you’d have to make the braces around the body mandatory.

Many (most?) C style guides make the braces mandatory, but it’d be a big step to actually change the language syntax that way. Tons of existing code would need to be updated. .. although I guess that could be automated!


You could probably do an either or thing: "You can drop the parentheses if you use braces. But you can't drop both". Though you're right, this is why it'll never happen.

Basically, C had a choice of eliding the parentheses around the condition or the braces around a single-statement block, and they chose the braces. With a half-century of hindsight, that was probably the wrong choice.


Interesting, either/or could work! That's a nice idea.

Syntactically it seems unambiguous because after an 'if' you just need to check for an '(', and if you don't find it you're looking for a '{' after an expression.

You'd lose forward compatibility, but I think there's precedent for that in C language revisions.


> One of the few times I get to remember that English is only my second language.

Most native speakers aren't aware of the terms. They'll call anything by any name.

There is a significant constituency for "curly brackets {}" and "square brackets []".

Anyway, there are mistakes you could make that would give you away as a nonnative speaker, but that wasn't one of them.


> There is a significant constituency for "curly brackets {}" and "square brackets []".

Yes, but there is still basically no constituency for “parentheses” (“{}”) or “parentheses” (“[]”), except in some narrow specific contexts; in programming, one example would be discussion of certain Lisp dialects where either all or certain uses of “()” in classic Lisp can (or, in the “certain” case, sometimes must) use the others, in which context “parentheses” are sometimes used generically for all three.

So, while there is a variety of ways paired delimiters are described by native speakers, the particular use here was still outside of the normal range of that variation.


The GP is only correct in America, and only in formal usage.

In everyday usage in the UK, I’d wager that most refer to () as brackets, [] as square brackets and {} as curly brackets.


This is not relevant to the actual context of the remark that was written. The mistake being corrected is the misreading of the word "parentheses", believing it to refer to `{` and `}`. Even in the UK, that conclusion is wrong. So the GP you refer to as "only correct in America" is simply "correct", period (full stop).


I never realized this. Does "parenthetical" still have the same meaning?


Yep.

Fun fact: parenthesis / parenthetical can mean 'a word or phrase inserted as an explanation or afterthought into a passage which is grammatically complete without it, in writing usually marked off by brackets, dashes, or commas.' (Merriam-Webster) - so you can have a parenthetical statement without using actual parentheses.


would that count?


In everyday use, by non programmers, they're all just brackets.


Good point - I should have said "everyday use among programmers". I don't imagine people regularly encounter braces or square brackets if not working in code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: