There are two schools of thought regarding named data
structures: name first and name last. The name last
school can define a named data structure as follows:
While the name first school would define the same data
structure as:
Although many systems provide a name first structure there
is no common practice to the words used. The words
BEGIN-STRUCTURE and
END-STRUCTURE have been
defied as a means of providing a portable notation that does
not conflict with existing systems.
The field defining words (
xFIELD:
and
+FIELD) are defined so they can be used by both
schools. Compatibility between the two schools comes from
defining a new stack item
struct-sys, which is
implementation dependent and can be 0 or more cells.
The name first school would provide an address (
addr)
as the
struct-sys parameter, while the name last
school would defined
struct-sys as being empty.
Executing the name of the data structure, returns the size of
the data structure. This allows the data stricture to be used
within another data structure: