Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

magic dictionary?

13 views
Skip to first unread message

luser- -droog

unread,
Mar 27, 2011, 2:50:12 AM3/27/11
to
Exciting NeWS! Some library in San Diego had a sale and
two of the Sun NeWS manuals showed up on amazon.
One's already arrived. It's even weirder than I could have
imagined! One stumper I've hit so far is the "magic
dictionary". It appears Adobe never did anything like this.

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?

Scott Prouty

unread,
Mar 29, 2011, 3:07:23 PM3/29/11
to

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...

luser- -droog

unread,
Mar 30, 2011, 5:44:46 PM3/30/11
to

Scott Prouty wrote:
>
> 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.

0 new messages