The list of reserved words in a language are defined when a language is developed. Occasionally, depending on the flexibility of the language specification, vendors implementing a compiler may extend the specification by including non-standard features. Also, as a language matures, standards bodies governing a language may choose to extend the language to include additional features such as object-oriented capabilities in a traditionally procedural language. Sometimes the specification for a programming language will have reserved words that are intended for possible use in future versions. In Java,
goto are reserved words — they have no meaning in Java but they also cannot be used as identifiers. By "reserving" the terms, they can be implemented in future versions of Java, if desired, without "breaking" older Java source code. Unlike overriding predefined functions, methods, or subroutines, reserved words may not be redefined by the programmer. The name of a predefined function, method, or subroutine is typically categorized as an identifier instead of a reserved word.
Not all languages have the same numbers of reserved words. For example, Java (and other C derivatives) has a rather sparse complement of reserved words -- approximately 25 – whereas COBOL has approximately 400. At the other end of the spectrum, pure Prolog has none at all.
The number of reserved words in a language has little to do with how “powerful” a language is. COBOL was designed in the 1950s as a business language and was made to be self-documenting using English-like structural elements such as verbs, clauses, sentences, sections and divisions. C, on the other hand, was written to be very terse (syntactically) and to get more text on the screen. For example, compare the equivalent blocks of code from Java and COBOL to calculate weekly earnings (reserved words are indicated in blue text):
Pure Prolog logic is expressed in terms of relations, and execution is triggered by running queries over these relations. Constructs such as loops are implemented using recursive relationships.
All three of these languages can solve the same types of “problems” even though they have differing numbers of reserved words. This “power” relates to their belonging to the set of Turing-complete languages.
Microsoft’s .NET Common Language Infrastructure (CLI) specification allows code written in 40 different languages to be combined together into a final product. Because of this, identifier/reserved word collisions can occur when code implemented in one language tries to execute code written in another language. For example, a Visual Basic.NET library may contain a class definition such as:
If this is compiled and distributed as part of a toolbox, a C# programmer, wishing to define a variable of type “
this” would encounter a problem:
'this' is a reserved word in C#. Thus, the following will not compile in C#:
A similar issue arises when accessing members, overriding virtual methods, and identifying namespaces.
In order to work around this issue, the specification allows the programmer to (in C#) place the at-sign before the identifier which forces it to be considered an identifier rather than a reserved word by the compiler.
For consistency, this usage is also permitted in non-public settings such as local variables, parameter names, and private members.
Patent Issued for Image Forming Apparatus, Control Method Therefor, and Storage Medium Storing Control Program Therefor
Dec 12, 2012; From Alexandria, Virginia, VerticalNews journalists report that a patent by the inventor Asahara, Hideo (Yokohama, JP), filed on...