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:

    The men the American people admire most extravagantly are the most daring liars; the men they detest most violently are those who try to tell them the truth. A Galileo could no more be elected President of the United States than he could be elected Pope of Rome. Both posts are reserved for men favored by God with an extraordinary genius for swathing the bitter facts of life in bandages of soft illusion.
    —H.L. (Henry Lewis)

    With veins rolling roughly over quick hands
    They have many clean words to say.
    My grandmothers were strong.
    Why am I not as they?
    Margaret Abigail Walker (b. 1915)

    It is silly to call fat people “gravitationally challenged”Ma self-righteous fetishism of language which is no more than a symptom of political frustration.
    Terry Eagleton (b. 1943)

    It is my duty to prevent, through the independence of Cuba, the U.S.A. from spreading over the West Indies and falling with added weight upon other lands of Our America. All I have done up to now and shall do hereafter is to that end.... I know the Monster, because I have lived in its lair—and my weapon is only the slingshot of David.
    José Martí (1853–1895)