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:

    We know of no scripture which records the pure benignity of the gods on a New England winter night. Their praises have never been sung, only their wrath deprecated. The best scripture, after all, records but a meagre faith. Its saints live reserved and austere. Let a brave, devout man spend the year in the woods of Maine or Labrador, and see if the Hebrew Scriptures speak adequately to his condition and experience.
    Henry David Thoreau (1817–1862)

    His very words are instinct with spirit; each is as a spark, a burning atom of inextinguishable thought; and many yet lie covered in the ashes of their birth and pregnant with a lightning which has yet found no conductor.
    Percy Bysshe Shelley (1792–1822)

    I do not speak with any fondness but the language of coolest history, when I say that Boston commands attention as the town which was appointed in the destiny of nations to lead the civilization of North America.
    Ralph Waldo Emerson (1803–1882)

    Hail, Columbia! happy land!
    Hail, ye heroes! heaven-born band!
    Who fought and bled in Freedom’s cause,
    Who fought and bled in Freedom’s cause,
    And when the storm of war was gone,
    Enjoyed the peace your valor won.
    Let independence be our boast,
    Ever mindful what it cost;
    Joseph Hopkinson (1770–1842)