[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Updaters in Pop (reply to query)



I have seen lots of discussion in the Scheme mailing list about "setters",
including this one from Jonathan A Rees (which gives just about enough 
context):

| Someone, I don't remember who, pointed out that the "setter" idea (i.e.
| a function that maps an access procedure (not its name) to a
| corresponding mutator) is not original with T, but was in the language
| POP2. Does anyone know of a reference for this?  Does anyone know how
| this was implemented (global table as in Lyn's message, or local
| association as in T)?

I don't know how it was done in Pop2, but I *do* know how it is done in Pop11,
its indirect descendant (alive and kicking in Sussex University's Poplog and
Cognitive Applications Ltd AlphaPop).

Every procedure has a component called its _updater_, which is either a 
procedure or the object _false_. When a procedure call appears as the target of
an assignment, this is treated as a call to its updater. Thus the command

    E -> f( x )         (Pop assignments run left-to-right)

is treated as

    updater( f )( E, x )

The updater component is an actual field of the procedure record, although it
could of course be implemented as a property (hash table) mapping procedures to
their updaters. This however would make access to the updater rather expensive.

_updater_ has an updater with the obvious effect, allowing the user to define
the update effect of her own procedures; the language has syntax to facilitate
this. Note that is the *procedure* that has the updater, not its name, so the
updaters of procedures passed as parameters are accessible in the same way as
procedures defined at the outermost level (well, of course they would. Wouldn't
they?).

I would be happy to answer any queries this incomplete account raises in email.


Regards, Kers. | If anything anyone lacks, they'll find it all ready in stacks.