Reserved Identifier - Reserved Words and Language Independence

Reserved Words and Language Independence

Microsoft’s .NET Common Language Infrastructure (CLI) specification allows code written in 40+ different programming 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:

' Class Definition of This in Visual Basic.NET: Public Class this ' This class does something... End Class

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#:

// Using This Class in C#: this x = new this; // Won't compile!

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.

// Using This Class in C#: @this x = new @this; // Will compile!

For consistency, this usage is also permitted in non-public settings such as local variables, parameter names, and private members.

Read more about this topic:  Reserved Identifier

Famous quotes containing the words reserved, words, language and/or independence:

    Damn with faint praise, assent with civil leer,
    And, without sneering, teach the rest to sneer;
    Willing to wound, and yet afraid to strike,
    Just hint a fault, and hesitate dislike;
    Alike reserved to blame, or to commend,
    A timorous foe, and a suspicious friend;
    Dreading e’en fools, by flatterers besieged,
    And so obliging, that he ne’er obliged;
    Like Cato, give his little senate laws,
    And sit attentive to his own applause:
    Alexander Pope (1688–1744)

    Of the modes of persuasion furnished by the spoken word there are three kinds. The first kind depends on the personal character of the speaker; the second on putting the audience into a certain frame of mind; the third on the proof, provided by the words of the speech itself.
    Aristotle (384–323 B.C.)

    The great enemy of clear language is insincerity. When there is a gap between one’s real and one’s declared aims, one turns as it were instinctively to long words and exhausted idioms, like a cuttlefish squirting out ink.
    George Orwell (1903–1950)

    Our treatment of both older people and children reflects the value we place on independence and autonomy. We do our best to make our children independent from birth. We leave them all alone in rooms with the lights out and tell them, “Go to sleep by yourselves.” And the old people we respect most are the ones who will fight for their independence, who would sooner starve to death than ask for help.
    Margaret Mead (1901–1978)