Friday, April 19, 2013

some terminology for discussing programming languages

Abstraction : an immutable value that can be be referenced but not changed. In applicative languages, all values are abstractions. In languages with objects (which includes slots), an expression that references an abstraction can change, but only by being modified to reference a different abstraction. The abstraction itself does not change. This is in contrast to an object which can change while remaining the very same object. Numbers and other mathematical objects are typical abstractions. Queues and other dynamic data structures are typical objects

Active Slot: a slot that can cause a state change when dereferenced or can cause a state change when updated other than simply changing the current value in the slot.

Aliasing: the situation when two or more variables denote the same slot

Denotation: The entity that a name or other expression represents. In languages with slots, denotation is not the same as reference. A variable denotes a slot but references the value in the slot

Declaration: A syntactic construct that introduces a new name into a namespace. In many languages declarations are also associated with a constraint on the type of the name

Definition: A declaration that also specifies the entity that the name denotes. A definition is a form of constraint; it constrains the name to be equal to its denotation

Class: a set of values and operations on those values. A class is a property of a value, not of a name or variable. A value can have multiple classes, but each value has a distinct base class

Constant: a name that denotes a fixed value --that is, not a slot. For a constant, the denotation and reference are the same

Constraint: a proposition that must be satisfied. A type declaration is the typical kind of constraint. Pre-conditions, post-conditions, and compiler-checked invariants are also constraints. Constraints can be used as a form of redundancy to help ensure program correctness and can also be used to optimize execution. In logic programming languages, the entire program is a constraint and the process of finding a way to satisfy the constraint is the execution of the program

Entity: a language thing that can be denoted by a name or other syntactic construct but may not be a value. Typical non-value entities include types, state changes and slots. In some languages, functions are non-value entities. Entities are divided into two main categories: abstractions and objects, depending on whether they are immutable or mutable.

Expression: a phrase that represents a value.

Object: a mutable entity –an entity that can change over the the course of a program while remaining the same entity. For example, if a set has operations to insert and delete from the set then it is an object. A set that is fixed and unchangeable would be an abstraction rather than an object

Phrase: a program fragment that forms a syntactic unit. For example in C, "x=3" is a phrase because it forms a complete syntactic unit but "x=" is not, because it is an incomplete fragment of syntax.

Reference: the value that an expression references. If an expression denotes a value then it also references that value. If it denotes a slot, then it references the object in the slot. If it denotes some other entity that is not a value, then it has no reference. Typically operations and function calls act on the references of their operands or parameters

Slot: a special object that can be updated to take on different values dynamically. An expression that denotes a slot is said to reference the value in the slot. Slots are entities but not values

State Change: A change in the world represented by the program. Specifically, a change in one or more objects of the program because only objects can change. Machine level changes such as assignment of intermediate results to registers or the advance of the program counter do not count as state changes within the program.

Statement: a syntactic unit that represents a state change.

Type: a set of values that an expression can reference. A type is associated with expressions, not values. In other words, there is no such thing as the type of a value. Since a type is a set of values, a value can have many types. Values have a base class instead. A type can include all of the values of a given class, or of a set of classes or only some of the values of a class

Value: an entity that can be the reference of an expression, passed as a parameter to function, and returned by a function. Slots cannot be values. The value of an expression is the value referenced by the expression

Variable: a name that can change its reference over the course of a program. Not all variables can be updated. For example, the formal parameters of a function are variables even if they cannot be changed during a given call. They are variables because they take on different values for different calls

No comments:

Post a Comment

Comments, criticism, questions and answers are all welcome, but please keep it polite and relevant to the post.