Single assignment

Single assignment

Single assignment is used to describe a programming language or representation in which one cannot bind a value to a name if a value has already been bound to that name. In other words, a variable is "initialized" with (i.e. "bound" to) a value at the time that it is created, and it cannot be assigned to. It prevents some types of side effects, which is claimed to reduce software bugs and simplify debugging.

Note: in some cases partial values could be used in more than one assignment as far as the partial values used in these assignments are compatible. Sometimes such variables are called declarative variables or dataflow variables. For further reading see CTM.

Implementations

Single assignment is used in several compilers and languages.

Compilers

Static single assignment form, SSA form, SSA, compiler representation

Languages

*Functional (these use single assignment to reduce side effects)
**Erlang
**Haskell
**SASL
**SISAL
**Oz
**OCaml - in OCaml, "variables" can only be single-assigned; however, members of arrays and mutable members of records and objects can be assigned to regularly
*Object-oriented
**Lava
**Oz

Some languages also support single assignment as an option.

*C# uses the "readonly" keyword next to a variable declaration.
*Java uses the "final" keyword next to a variable declaration.
*C++ uses the "const" keyword next to a variable declaration (only when the const modifies the type; not for "pointer-to-const" things).
*Scala when declaring variables with "val" instead of "var".

The use of these features, is however generally restricted to OO design decisions, such as making an object immutable.

ee also

* Immutable object
* Const-correctness


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • single assignment — vienkartinis priskyrimas statusas T sritis automatika atitikmenys: angl. single assignment vok. einmalige Zuordnung, f rus. одноразовое присваивание, n pranc. assignation unique, f …   Automatikos terminų žodynas

  • Static single assignment form — In compiler design, static single assignment form (often abbreviated as SSA form or SSA) is an intermediate representation (IR) in which every variable is assigned exactly once. Existing variables in the original IR are split into versions , new… …   Wikipedia

  • Static Single Assignment — Zwischencode ist Code, der im Verlauf eines Übersetzungsprozesses auf einer Abstraktionsebene zwischen der höheren Ausgangssprache und der in der Regel maschinennahen Zielsprache generiert wird. Es handelt sich in erster Linie um einen im… …   Deutsch Wikipedia

  • assignment and assumption agreement — USA assignment and assumption agreement, Also called an assignment and assumption. An agreement in which one party transfers its contractual rights and obligations to another party. For forms of assignment and assumption agreements for bank loans …   Law dictionary

  • assignment and assumption — USA assignment and assumption agreement, Also called an assignment and assumption. An agreement in which one party transfers its contractual rights and obligations to another party. For forms of assignment and assumption agreements for bank loans …   Law dictionary

  • Static single assignment form — En compilation, Static single assignement form (abrégé en SSA) est une représentation intermédiaire (abrégé RI) du code source d un programme dont la particularité est de ne permettre à une variable d être affectée qu une et une seule fois. Les… …   Wikipédia en Français

  • Assignment (computer science) — In computer programming, an assignment statement sets or re sets the value stored in the storage location(s) denoted by a variable name. In most imperative computer programming languages, assignment statements are one of the basic statements.… …   Wikipedia

  • Single-grain experiment — The single grain experiment was an experiment carried out at the University of Wisconsin Madison from May 1907 to 1911. The experiment tested if cows could survive on a single type of grain. The experiment would lead to the development of modern… …   Wikipedia

  • Generalized assignment problem — In applied mathematics, the maximum general assignment problem is a problem in combinatorial optimization. This problem is a generalization of the assignment problem in which both tasks and agents have a size. Moreover, the size of each task… …   Wikipedia

  • Drive letter assignment — is the process of assigning alphabetical identifiers to physical or logical disk drives or partitions (drive volumes) in the root filesystem namespace; this usage is now mostly found in Microsoft operating systems. Unlike the concept of UNIX… …   Wikipedia

Share the article and excerpts

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