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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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:
...
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 ...
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: ...
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
...
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 ...
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 ...
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();
}
<...
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 ...
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 ...
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 ...
3
votes
What Unicode character categories should be allowed in identifiers?
When programming mathematical formulas, non-Roman characters are handy.
...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
identifiers × 5syntax × 2
unicode × 1
c × 1
semantics × 1
types × 1
functions × 1
namespaces × 1
variables × 1