[Oberon] Assignment to value parameters of pointer or procedure type

Diego Sardina dsar at eml.cc
Sun Feb 9 15:00:42 CET 2025


Pointers and procedure variables are of basic types.

In an old email Wirth confirmed that the terms basic and scalar types were synonyms.

Wirth's intention was to pass only structured types (array and records) as read-only references in the case of value parameters.

In Differences between Revised Oberon and Oberon:
"[...] we postulate that if a value parameter is if a structured type, no assignments are possible. Hence, the parameter can be passed by a reference like in the case of VAR parameters."

PIO:
"If a parameter of a structured type is specified without the symbol VAR, it is considered to be "read-only", i.e. no assignments to it are allowed."

Unfortunately only in the report he mentions basic types as the ones to be copied to a local variable, that may cause confusion since there is an explicit list on the Report (that excludes pointers and procedure variables).

However by reading PIO:

"Types are classified into unstructured and structured types. Each type essentially defines the set of values which a variable of this type may assume. A value of an unstructured type is an atomic unit, whereas a value of structured type has components (elements). For example, the type INTEGER is unstructured; its elements are atomic. It does not make sense, e.g. to refer to the third bit of the value 13; the circumstance that a number may "have a third bit", or a second digit, is a characteristic of its (internal) representation, which intentionally is to remain unknown."

And later (just as confirmation):

"Pointers, i.e. values of pointer types, are themselves not structured, but rather are used to establish relationships [...]"

Based on his definition of unstructured and structured types, also procedure variables are of basic type, since they have no components (like arrays and records).


-- 
  Diego Sardina


More information about the Oberon mailing list