For objects that represent canvases or processes, altering
a property by defining a new key-value pair as if the object
were a dictionary automagically updates the behavior of
the object. I can imagine a few ways of trying to pull this
off, but no clear winner among them.
One way would be to overload the put operator to
call a type-specific update function which just runs through all the
properties and applies changes for any
discrepencies.
It could have a function-slot for each field instead of
one do-everything function.
Or some kind of newly-changed flag, and whatever
other process is using this information gets locked-out
for a moment and then finds the new info for itself.
Or the magic dictionary abstraction itself could be
promoted and any dictionary could be fitted with a
call-on-value-change procedure.
Now that I'm pretty happy with the low-level parts of
my interpreter (for now), I'm trying to focus on building
higher rather than wider.
Or maybe there's some better way I haven't thought of?
I suppose this is something like the page device dictionary used for
"setpagedevice". Of course the dictioanry passed to "setpagedevice"
is merged with the device dictionary and then activated at the
"setpagedevice" call. So, for example, duplexing can't be activated
like this:
currentpagedevice /Duplex true put
But of course it can be like this:
<</Duplex true>> setpagedevice
It sounds like NeWS could do the former...
Yes. If currentpagedevice is a magic dictionary, the setpagedevice
could be simply:
/setpagedevice {
currentpagedevice begin
{def} forall
end
} def
But I'm probably getting way ahead of myself worrying about how to
do this. Garbage Collection, expandable dictionaries, deleting keys:
all of these probably need to happen first.
But it is the wild speculation that's the fun part.