[I must get our news machine mounted, so that I can use the POP reader...]
Steve K. [it was I think] suggested a more efficient implementation of
dynamic lists could be obtained by having a separate record to hold the
generating function. That would seem to be a good idea, since dynamic lists
should be used abstractly. The only occasion recently when I recall
actually looking at the structure of a dynamic list is in the error
reporting mechanism of parse_gen. Error reporting is of course always the
trouble spot where abstractions break down etc. What the error reporting
mechanism needs to do is to potter along the expanded dynamic list until it
finds the unexpanded part, which is where the parser must have failed to
find a parse. However, the code I have written would actually work OK if
the suggestion of a separate terminating record were adopted. But a
predicate to recognise whether you are looking at a completely unexpanded
dynamic list would be a help.
As to why in the first place we used a list cell for the termination - I
don't recall any alternative being discussed, and indeed we might not even
have implemented general records at the time the problem came up. I seem to
recall that we tried to do something to respond to noises that Peter Landin
was making in 1967 about streams needing to be respectable things with a
stable denotation, and came up with dynamic lists. I wasn't aware at the
time of any perceived need for a general laziness.
Re. Steve's suggestion of using the 'extra' tag combination (1 out of 8 in
the original POP-2 implementation, 1 out of 4 in POPLOG) This would seem to
be a good idea, apart from the apparently unavoidable inefficiency
introduced into recognisers (which he pointed out). I can't think of any
way out of this - zoos are bad news I think. If there is to be any
spatial separation, modern consensus is towards separating generations
rather than types.
One hack that has been tried in the persistent language community (and as
Steve observes, one might regard persistence as a delayed read from backing
store) has been to force a page-fault when such a delayed beast is
encountered. However, with current operating systems, this probably works
better for persistence (where you are going to have wait quite a while
anyway) than for general laziness.
Robin.
|