Predeclared
   HOME

TheInfoList



OR:

In computer languages, the built-in information, encodings or tools that are available to a
programmer A programmer, computer programmer or coder is an author of computer source code someone with skill in computer programming. The professional titles Software development, ''software developer'' and Software engineering, ''software engineer' ...
are pre-declared, often in the form of entities, variables, objects, functions or instructions. It is mostly not possible to overwrite or otherwise manipulate them.


Pre-declared entity

A pre-declared entity is a built-in notation convention for a character or a
string String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * ''Strings'' (1991 film), a Canadian anim ...
. For example, in the
HTML Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
markup language, a large number of character and numeric entities are available to represent characters. In HTML, '&lt;' is a possible pre-declared entity to represent '<'. The programmer must not declare this entity by himself before he can use it, since it is already pre-declared by the specifications of the
HTML Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
language. Pre-declared entities are often used as
escape sequence In computer science, an escape sequence is a combination of characters that has a meaning other than the literal characters contained therein; it is marked by one or more preceding (and possibly terminating) characters. Examples * In C and ma ...
s to represent information that would otherwise cause possible conflicts in its non-encoded form.


Pre-declared variable

When a variable is pre-declared, it provides the programmer with information that he might be interested in. For example, in the
Perl Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language". Perl was developed ...
language, a variable %ENV is pre-declared, holding all kinds of environmental information such as the
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
, host information, user information, and many more. Other pre-declared variables in Perl are %INC and %SIG. Almost all common programming languages provide the programmer with such pre-declared variables in one or another form. When variables are pre-declared, it is commonly assumed that the value for the pre-declared name is also pre-assigned at the same time.


Pre-declared object

Pre-declared
object Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Object (abstract), an object which does not exist at any particular time or place ** Physical object, an identifiable collection of matter * Goal, an a ...
s have the same goal as pre-declared variables. For example, in the
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
language, the navigator-object is available to get all kinds of information about the browser that is running the script in question.


Pre-declared functions and instructions

Pre-declared functions or instructions are built-in tools to perform common tasks. For example, in the earliest
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
s the
square root In mathematics, a square root of a number is a number such that y^2 = x; in other words, a number whose ''square'' (the result of multiplying the number by itself, or y \cdot y) is . For example, 4 and −4 are square roots of 16 because 4 ...
needed to be calculated by hand. Nowadays programming languages have a pre-declared instruction or function for this task. Pre-declared functions or instructions often hold common tasks and their goal is to simplify the work of the programmer. The available pre-declared instructions or functions can in some languages be extended by using external libraries or modules.


Narrow semantic sense

In a narrow strictly
semantic Semantics is the study of linguistic Meaning (philosophy), meaning. It examines what meaning is, how words get their meaning, and how the meaning of a complex expression depends on its parts. Part of this process involves the distinction betwee ...
sense, the term pre-declared may also refer to the declaration of a variable before an assignment takes place. In the following example, the first line is the (pre-)declaration and the second the assignment: var A; A = 1; By declaring the name A, the program creates a
namespace In computing, a namespace is a set of signs (''names'') that are used to identify and refer to objects of various kinds. A namespace ensures that all of a given set of objects have unique names so that they can be easily identified. Namespaces ...
for the variable called A. In most modern languages, the variable does not need to be pre-declared on a separate line, as the following instruction achieves exactly the same: var A = 1; In early computer languages, the variable always needed to be pre-declared as a separate instruction, because the
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
had to reserve a series of
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable un ...
s in the available RAM, before the actual value of the variable could be stored in it. Declaration and assignment are still two fundamental different things, though they nowadays mostly appear in a same instruction line. Programming constructs Computer programming