Keyword (computer programming)

Keyword (computer programming)

In computer programming, a keyword is a word or identifier that has a particular meaning to the programming language. The meaning of keywords — and, indeed, the meaning of the notion of "keyword" — differs widely from language to language.

In many languages, such as DECLAN, C and similar environments like C++, a "keyword" is a reserved word which identifies a syntactic form. Words used in control flow constructs, such as if, then, and else are keywords. In these languages, keywords cannot also be used as the names of variables or functions.

Some languages, such as PostScript, are extremely liberal in this approach, allowing core keywords to be redefined for specific purposes.

In Common Lisp, in contrast, "keywords" (or "keyword symbols") are a special sort of symbol, or identifier. Unlike other symbols, which usually stand for variables or functions, keywords are self-quoting and evaluate to themselves. Keywords are usually used to label named arguments to functions, and to represent symbolic values.

Languages vary as to what is provided as a keyword and what is a library routine. Some languages, for instance, provide keywords for input/output operations whereas in others these are library routines. In Python and many BASIC dialects, print is a keyword. In contrast, the C and Lisp equivalents printf and format are functions in the standard library.

In languages with macros or lazy evaluation, control flow constructs such as if can be implemented as macros or functions. In languages without these expressive features, they are generally keywords.

ee also

*Java keywords


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Literal (computer programming) — In computer science, a literal is a notation for representing a fixed value in source code. Almost all programming languages have notations for atomic values such as integers, floating point numbers, strings, and booleans; some also have… …   Wikipedia

  • Transient (computer programming) — Programming = Java In the Java programming language, transient is a keyword used as a field modifier. When a field is declared transient, it would not be serialized even if the class to which it belongs is serialized. It must be noted that in… …   Wikipedia

  • Class (computer programming) — In object oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable …   Wikipedia

  • this (computer programming) — In many object oriented programming languages, this (also called self or Me) is a keyword that is used in instance methods to refer to the object on which they are working. C++ and languages which derive in style from it (such as Java, C#, and… …   Wikipedia

  • Method (computer programming) — In object oriented programming, a method is a subroutine (or procedure or function) associated with a class. Methods define the behavior to be exhibited by instances of the associated class at program run time. Methods have the special property… …   Wikipedia

  • Destructor (computer programming) — In object oriented programming, a destructor (sometimes shortened to dtor) is a method which is automatically invoked when the object is destroyed. Its main purpose is to clean up and to free the resources (which includes closing database… …   Wikipedia

  • Keyword — A keyword is a word or concept with special significance, in particular any word used as the key to a code or used in a reference work to link to other words or other information.The term keyword in reference to Search Engine Marketing (SEM)… …   Wikipedia

  • Constructor (object-oriented programming) — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • Comparison of programming languages (object-oriented programming) — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • Object-oriented programming — Programming paradigms Agent oriented Automata based Component based Flow based Pipelined Concatenative Concurrent computing …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”