Following previous discussions on the net and with the FP people here, it
seems more clear that the analogue for type-language is with function-
definition and not with pattern-matching. Thus my "All" construct should be
seen as analogous to "procedure". So I agree with Steve's suggestion of
List(a)
or for that matter list(a) --- capitalisation is merely a convention, but
would argue against the ? and ?? forms. To extend the discussion to
data-types.
Consider the SML declaration:
datatype 'a Tree = Node of 'a Tree* 'a Tree | Tip of 'a
how should something like this be treated in POP? I would unbundle it as
Tree(a) = Node(a) + Tip(a)
or alternatively, and within declare....enddeclare brackets
define Tree(a); Node(a) + Tip(a)
enddefine;
That is the second-order definitions may have the same form as the existing
first-order definitions.
And the second part of the definition is
defstruct Node(a) = {left:Tree(a),right:Tree(a)}
If the -defstruct- is omitted, then the declaration is -abstract-, i.e. no
data-key and associated first-order functions are created. In either case
the following declarations are made:
consNode : All a; Tree(a)*Tree(a) -> Node(a)
destNode : All a; Node(a)-> Tree(a)*Tree(a)
isNode ? All a; Node(a)
left : All a; Node(a) -> Tree(a)
right : All a; Node(a) -> Tree(a)
Robin.
|