Skip to main content
39 votes

Pros and cons of semantically-significant capitalization

Con: Doesn't work well for identifiers in alphabets other than latin Most programing langues nowadays support unicode identifiers. This allows writing identifiers in languages other than english. ...
mousetail 'he-him''s user avatar
27 votes

Pros and cons of semantically-significant capitalization

Con: inflexibility Using Go as an example, if you have a private identifier and want to make it public, you have to effectively rename it, which means changing code at every point where the identifier ...
xigoi's user avatar
  • 1,055
18 votes

Pros and cons of semantically-significant capitalization

Cons: You move representation of a binary property into the identifier concept. Go is actually a good example of why this is a bad idea. With their decision, they are now stuck with a binary ...
feldentm's user avatar
  • 2,192
13 votes

Pros and cons of semantically-significant capitalization

Case has long been used by convention to indicate roles of identifiers. For instance, in C it's conventional to use ALLUPPER for macros, and either snake_case or camelCase for other identifiers. In ...
Barmar's user avatar
  • 1,980
9 votes

What Unicode character categories should be allowed in identifiers?

https://unicode.org/reports/tr31/ is the Unicode standard for which characters should be available for use in identifiers. Any identifier system for a new language should make that its basis for ...
prosfilaes's user avatar
8 votes

What Unicode character categories should be allowed in identifiers?

If your goal is to let users name identifiers using words from any natural language, you pretty much need to permit anything from "L" (the letters) and "M" (the modifiers -- things ...
Mark's user avatar
  • 284
7 votes

Pros and cons of semantically-significant capitalization

One advantage is that you can lexically distinguish between two different classes of identifier, which could be useful if they need to be parsed differently. A good example of this is Haskell, which ...
occipita's user avatar
  • 579
7 votes
Accepted

Are there any technical limitations against adding anonymous functions in C?

Closures are complicated C is and always has been a simple language, and it tries to remain that way even today. If you wanted to add the ability to make simple non-closing functions as local ...
Silvio Mayolo's user avatar
7 votes

What are the pros and cons of more permissive identifier character sets?

Pros Symbols can express something much shorter than letters or numbers. I recall some JavaScript code style which used to prefix all jQuery collection variables (e.g. the result of ...
Glorfindel's user avatar
  • 1,523
6 votes
Accepted

Types and variables in a different namespace

A number of existing languages do allow this and there is no particular issue with it. Java permits it for reference types, for example, as do C# and Scala: ...
Michael Homer's user avatar
  • 13.6k
6 votes

Pros and cons of semantically-significant capitalization

Con: screenreaders typically either don’t announce all-caps any differently to lowercase words, or, worse, can read them letter by letter as if they were an abbreviation. Language developers shouldn’t ...
Robin Whittleton's user avatar
5 votes

Pros and cons of semantically-significant capitalization

Cons: not extensible There are only two cases. It can be a hard time if, for example, we need to add protected support to a newer version of the language. Cons: ...
tonychow1997's user avatar
5 votes

What Unicode character categories should be allowed in identifiers?

My suggestion: Initial characters: Ll Lower case letter Lo Other letter Lt Title case letter Lu Upper case letter Ni Letter number _ Low line ...
Adám's user avatar
  • 3,236
5 votes

What Unicode character categories should be allowed in identifiers?

Be inclusive I'm going to suggest allowing the widest range of characters you can, and let the programmer make good choices for themselves. I'm also going to suggest allowing an even wider range than ...
Michael Homer's user avatar
  • 13.6k
5 votes

Pros and cons of semantically-significant capitalization

Similar to occipita's answer, but for humans instead of compilers: When reading code, it can be useful to immediately be able to tell whether a given identifier is public or private, without going to ...
pxeger's user avatar
  • 848
4 votes

Types and variables in a different namespace

This is already possible in some popular programming languages: for example, Java and Typescript both allow this. class Foo { static Foo Foo = new Foo(); } <...
kaya3's user avatar
  • 20.8k
4 votes

What Unicode character categories should be allowed in identifiers?

From a usability-based perspective, one might decide that identifiers should match [a-zA-Z_][a-zA-Z0-9_]*, i.e. a Latin alphabet letter or underscore, followed by 0 ...
kaya3's user avatar
  • 20.8k
3 votes

What Unicode character categories should be allowed in identifiers?

Unless you're writing for a specific niche that would benefit from non-English identifiers, don't allow non-ASCII characters in identifiers. Non-ASCII identifiers cause many problems for several ...
Gilles 'SO- stop being evil''s user avatar
3 votes

Are there any technical limitations against adding anonymous functions in C?

Apple did it, so the answer is obviously No, there is no technical limitation. Apple added a non-standard feature called Blocks to their implementation of C in order to support easy use of the Grand ...
Jörg W Mittag's user avatar
3 votes

What Unicode character categories should be allowed in identifiers?

When programming mathematical formulas, non-Roman characters are handy. ...
Ray Butterworth's user avatar
1 vote

Types and variables in a different namespace

Function call or type cast? One example of an ambiguous statement in a C-style language that supports type names and object names overlapping is if there is a function or function pointer called ...
CPlus's user avatar
  • 9,143
1 vote

What are the pros and cons of more permissive identifier character sets?

If a language limits identifiers to printable (non-blank) ASCII characters, then each identifier will have a unique visual representation in any font designed to be suitable for programming tasks, and ...
supercat's user avatar
  • 1,996

Only top scored, non community-wiki answers of a minimum length are eligible