🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.postscript
2 messages
2 total messages Started by Eric Marshall Wed, 27 Jan 1993 21:49
question about restore
#6526
Author: Eric Marshall
Date: Wed, 27 Jan 1993 21:49
25 lines
965 bytes
	In the following code fragment:

	save
	  /three 3 def
	  three  % works fine
	restore

	three    % causes "undefined" error

I do not understand why three is not defined after the restore. 
The red book says that restore does not affect the contents of the
dictionary stack, but there is obviously something more to it than
that.  Could someone please explain this to me?

	Thanks in advance.


Eric Marshall
Software Productivity Consortium
SPC Building
2214 Rock Hill Road
Herndon, VA 22070
(703) 742-7153

marshall@software.org
Re: question about restore
#6554
Author: Allen B
Date: Thu, 28 Jan 1993 18:53
36 lines
1942 bytes
In article <1993Jan27.214901.19529@software.org> marshall@software.org (Eric  
Marshall) writes:
> I do not understand why three is not defined after the restore. 
> The red book says that restore does not affect the contents of the
> dictionary stack, but there is obviously something more to it than
> that.  Could someone please explain this to me?

It doesn't affect the dictionary stack, it affects the
value of the dictionary (which is in virtual memory
(VM)).  The save and restore operators have to do with VM.

The dictionary stack gets changed when you do things like
begin and end.  You seem to have some confusion regarding
the terminology and probably about the workings of
dictionaries in general.

Briefly (I'm sure you can read a Red Book to fill in the
gaps), a dictionary is an associative array that
associates keys (usually names) with values.  When you
said "/three 3 def" that associated the literal name
three with the integer 3 in the current diciotnary.  The
current dictionary is the one on top of the dictionary
stack.

The dictionary object on the dictionary stack is a
composite object.  Its value (all of the key-value pairs
defined in it) is in VM.  When you did the restore, VM was put
back the way it was when you made the save object (via the
save operator).  That got rid of the definition of three,
but left the current dictionary on top of the dictionary
stack.

Does that make sense?  I'm not sure exactly what you didn't
get, but I think that'll help. 

ab
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads