Topic: named constants and expressions

topics > computer science > data > Group: data value


abstraction in programming language
alias names
binding of names to objects
binding names to variables or expressions
definition languages
environment variables
function definition
implementation of Thesa data objects
initialized constants
non-primitive values
parameter passing by name
replacement as defining a variable
symbolic representation
value as an object
variables for array bounds


Literals are names for constants, expressions, or values. They are a form of paraphrase extension and abstraction. Constants or expressions have many possible meanings. For instance 425 may be the address of an edit routine, the number of apples in a crate, the melting point of a metal, the maximum number of man-hours allocated to a project, or the price of a radio. By naming constants and expressions the programmer specifies a particular meaning for what would have been a mystery number. Since literals stand for a value, they are equivalent to functions without arguments. The expression or constant associated with a literal cannot be changed. Dynamic constants are literals defined during execution. Their use within a procedure or refinement requires unique system generated names. If function definition is a legitimate value then the function's name is a literal standing for its definition. (cbb 5/80)
Subtopic: named constant up

Quote: a named constant is defined exactly once; any expression involving name constants has a fixed value as long as they are defined [»redeDH7_1979]
Quote: a 'const' reference can be the address of an initialized temporary; allows flexible initialization; useful for function arguments [»stroB_1991]
Quote: a C++ reference to a type is a synonym for the variable it is initialized to; used for overloaded operators, functions, and both sides of assignments [»stroB_1991]
Quote: global named constants are "wired in"; prevents multiple calls to a refinement [»redeDH7_1979]

Subtopic: system configuration up

Quote: classify parameters by likelihood of change and cost of variability; use run-time variables if low cost, system configuration variables if unlikely to change [»britKH3_1981]
Quote: use reconfiguration interfaces for device-dependent characteristics that vary at run-time; e.g., drift rate [»britKH3_1981]

Subtopic: named constants vs. numbers up

Quote: banned all mystery numbers above two [»clarBL9_1973]
Quote: with run-time translation of keys and offsets, would never use numbers except when desired [»lost entries, OK]
Quote: essential information in a specification must not rely on arbitrary details; e.g., use mnemonic names instead of numbers or sequences [»heniKL1_1980]
Quote: a manuscript should refer to files through indirect symbolic names; prevents dependence on a particular installation [»reidBK_1980]
Quote: produce special purpose instructions by using mnemonic abbreviations for computations of some given type
Quote: use abbreviations to indicate dialing information, allows the same phone number to be stored at every site; e.g., nyc or boston [»nowiDA8_1978]

Subtopic: constant as function up

Quote: a constant in Russell is any value-producing function of no arguments; must produce constant results [»demeA3_1979]

Subtopic: constant as function definition up

Quote: parameters carry values into refinements; global named constants carry values out [»redeDH7_1979]
Quote: in Forth, the constant EDIT is the address of the block that contains the editor; so EDIT LOAD loads the editor [»ewinMS9_1974]

Subtopic: examples up

Quote: in C, defined constants are usually upper-case names to distinguish from variables [»ritcDM7_1978c]
Quote: by defining constants via a macro processor, C allows any string of characters to be substituted

Related Topics up

Group: naming   (32 topics, 789 quotes)

Topic: abstraction in programming language (47 items)
Topic: alias names (39 items)
Topic: binding of names to objects (19 items)
Topic: binding names to variables or expressions (10 items)
Topic: constants (21 items)
Topic: definition languages (3 items)
Topic: environment variables (5 items)
Topic: function definition (25 items)
Topic: implementation of Thesa data objects (27 items)
Topic: initialized constants (12 items)
Topic: macros (22 items)
Topic: non-primitive values (11 items)
Topic: parameter passing by name (11 items)
Topic: replacement as defining a variable (8 items)
Topic: symbolic representation (26 items)
Topic: value as an object (29 items)
Topic: variables for array bounds
(7 items)

Updated barberCB 9/04
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.