Reserved Word - 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 Word

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

    This is that which we call Character,—a reserved force which acts directly by presence, and without means.
    Ralph Waldo Emerson (1803–1882)

    For the Lord thy God is a jealous God among you.
    Bible: Hebrew Deuteronomy, 6:15.

    The words are also found in Exodus 20:5, referring to the second commandment: “Thou shalt not make unto thee any graven image ... for I the Lord thy God am a jealous God, visiting the iniquity of the fathers upon the children unto the third and fourth generation of them that hate me.”

    Denotation by means of sounds and markings is a remarkable abstraction. Three letters designate God for me; several lines a million things. How easy becomes the manipulation of the universe here, how evident the concentration of the intellectual world! Language is the dynamics of the spiritual realm. One word of command moves armies; the word liberty entire nations.
    Novalis [Friedrich Von Hardenberg] (1772–1801)

    In England the judges should have independence to protect the people against the crown. Here the judges should not be independent of the people, but be appointed for not more than seven years. The people would always re-elect the good judges.
    Andrew Jackson (1767–1845)