Article View: comp.lang.postscript
Article #8509Re: The // operator
From: Ned Batchelder
Date: Fri, 26 May 1989 20:20
Date: Fri, 26 May 1989 20:20
20 lines
1655 bytes
1655 bytes
The // construct in PostScript is not an operator; it is more like a name modifier.
When a name is preceded by the double-slash, its current value is used instead of the
/a 17 def
/foo { a } def
/bar { /a } def
/baz { //a } def
"foo" is now a procedure which when executed will push the latest value of "a" on the
stack. The procedure actually contains the name "a", and it is looked up when the
procedure is executed.
"bar" is now a procedure which when executed will push the literal name "a" on the stack. No name lookup is performed.
"baz" is now a procedure which when executed will push 17 on the stack. The procedure actually contains the integer 17, because that is the value that "a" had at the time the procedure was defined. The double-slash means "lookup this name, and use its value just as it had appeared in the input". Of course, some values for names may not have a representation
in the input stream, such as dictionaries.
Be careful when using the double-slash (if at all), because older PostScript interpreters don't have it, and there is no way your program will work properly on them.
Ned Batchelder, Digital Equipment Corp., BatchelderN@Hannah.DEC.com
Technical Details
Message-ID:
<2586@shlump.dec.com>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!decwrl!shlump.dec.com!icosa.dec.com!batcheldernReferences:
<441@mtk.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!decwrl!shlump.dec.com!icosa.dec.com!batcheldern From: batcheldern@icosa.dec.com (Ned Batchelder) Newsgroups: comp.lang.postscript Subject: Re: The // operator Message-ID: <2586@shlump.dec.com> Date: 26 May 89 20:20:29 GMT References: <441@mtk.UUCP> Sender: news@shlump.dec.com Distribution: usa Organization: Digital Equipment Corporation Lines: 20