Topic: data types in Thesa
Topic: pointers to data
Topic: primitive data types for Thesa
Topic: Thesa data structures
| |
Summary
Memory is a byte string at some base plus offset with a first and end index. It has an address. The address may be in registers, it may be a pointer or a segment, or it may be derived from a declared region of physical memory. Its representation in code may vary.
In C and Pascal, everything has an address, i.e., an index into a byte string. This is the flat memory model. Cedar and Java do not use pointers. They use immutable references instead. This maintains type information. (cbb 8/96)
To maintain uniform reference, want to hide pointers as much as possible. For example, in a data structure, a complex number and a pointer to a complex number is the same. The distinction arises in memory management and sharing. (cbb 4/93)
The problem is that pointers are really another name for memory. Memory is described by both base and offset. The prototypical examples are records and arrays.
The idea of memory as base plus offset is unusual. This makes fields and arrays as the main form. Which is certainly my experience.
Maybe think of pointers as really indices. This matches with firstbase, stride etc. So a pointer is an index with an implicit base. A<-B, the base of A is the base of B. But what about 'curdata'? I think that is a base. So what about B<-A[I], but A[I] is not a base, instead use B<-A+I, then what about B<-A.r? So B has the same base as A and the offset of A[I].
So A is memory that is at a base+offset. A 'base' in x86 is ultimately a segment. Now what is the base of B, if A is local? It depends on whether B always has the same base. If B and C are parameters, need a compiler directive to unify them. Note that indexes as parameters don't need a unified base, but then they're explicit. CodeIdA CurIds, just use a compiler directive. Then it must be checked?
Subtopic: fields and object pointers
Note: a pointer machine has local pointers (fields) and global pointers (objects); pointing with each hand; fields are unique within the object [»cbb_2000, OK]
| Subtopic: pointers to data
Topic: pointers to data
| Topic: recursive data structures
| Topic: undefined, null, and other signal values
| Quote: data structures consist of templates of arbitrary elements (e.g., functions); implement with pointers [»hallJC5_1974, OK]
| Subtopic: variables
Topic: variable as reference to storage
| Topic: replacement as setting a reference to a value
| Topic: variable as reference to a value
| Topic: parameter passing by reference
| Topic: primitive data type as memory
| Quote: a variable denotes a fixed address whose content is its value [»straC3_1973]
| Quote: in C, '->' is shorthand for accessing a structure component via a dereferenced pointer [»ritcDM7_1978c]
| Subtopic: parameters as pointers
Note: a parameter is an object field, a reference to a pointer; value semantics is an optimization [»cbb_1990, OK]
| Subtopic: naming
Topic: names independent of objects
| Topic: uniform reference to data
| Topic: referential transparency
| Quote: a variable is an abstraction of an operand [»cbb_1973, OK]
| Quote: Mesa automatically handles p<-v and v<-p when v is a variable and p is a pointer [»gescCM6_1975, OK]
| Subtopic: reference
Topic: meaning vs. reference
| Topic: is a name a literal string or a symbol
| Topic: using an address as a name
| Topic: names as rigid designators
| Topic: using a description as a name
| Quote: can identify an object by pointing to it; this holds in other possible worlds [»kripSA_1980]
| Quote: if variables are place holders then problems with self-reference and aliasing [»backJ_1972, OK]
| Subtopic: safety
Topic: safe use of pointers
| Topic: shared objects
| Topic: dangling pointers
| Topic: alias names
| Quote: Simula provides safe reference by separating reference from the thing itself; e.g., queue elements have succ, pred, out, and into [»nygaK10_1983, OK]
| Quote: restrict pointers to implementation of abstract data types; only inside clusters [»berrDM4_1977]
| Quote: Oberon's garbage collector must be safe; use type guards, range checks, and NIL tests for all pointers [»wirtN9_1989]
| Quote: pointer-linked data structures are error prone due to unconstrained use of pointers [»franRS4_1983]
| Quote: a reference type conforms with a variable if it is a reference to the mode of the variable [»bekiH_1971, OK]
| Quote: Cedar's safe pointers ensure integrity of system data structures and code [»swinDC7_1985]
| Quote: Cedar's safe storage improves system structure, convenience, and reliability [»swinDC7_1985]
| Quote: Cedar reference variable contains address of collectible, single typed, data object; called a REF
| Quote: Cedar reference variables can be freely replicated and discarded due to garbage collection [»swinDC7_1985]
| Quote: because of aliasing, changing one variable may accidentally change another [»hehnEC_1977a]
| Quote: prevent inadvertent aliasing by not importing var variables with local var declarations [»demeA3_1979]
| Quote: Euclid avoids aliasing by explicitly importing all non-local variables [»veneT3_1978]
| Note: auto creation of objects on Null access runs out of space like running out of time [»cbb_2000, OK]
| Subtopic: two-way pointer
Quote: some frame languages use two-way pointers to update inverse relations; avoids tangling pointers by automatically updating all references [»tichWF11_1987]
| Subtopic: casting
Topic: ref_any or Object data type
| Topic: casting a variable to a different type
| Quote: operations defined on the type 'type' to return all instances, legal operations, and legal properties [»zdonSB11_1986]
| Quote: can cast a variable to type Anytype; communicate it; then recast it to its original type for use [»stroR10_1986]
| Quote: a Cedar REF ANY variable requires runtime type verification before access or modification [»swinDC7_1985]
| Quote: instead of an UNSPECIFIED type, use RECAST to treat the same value differently [»gescCM8_1977]
|
Related Topics
Topic: data types in Thesa (92 items)
Topic: pointers to data (55 items)
Topic: primitive data types for Thesa (82 items)
Topic: Thesa data structures (59 items)
|