[comp.lang.postscript] Name Lookups

pallas@Neon.Stanford.EDU (Joe Pallas) (09/03/89)

Glenn Reid gives three ways to use local dictionaries in PostScript
procedures.  One of them uses //, which doesn't work for the
LaserWriter Classic and isn't documented in the Red Book.  One of them
is hairy, but clean.  One of them is perfectly readable and portable,
but less desirable because it pays for a name lookup.

Can someone tell me why name lookups are so expensive in PostScript
that everybody goes out of their way to avoid them?  Instead, we get
gross things like // and bind (the use of which is officially
discouraged in the Red Book, but everybody uses it anyway).  And much
of the power of PostScript gets lost (try wrapping code that redefines
showpage around Mac PostScript, for example).

It seems to me that people spend more time cursing and circumventing
PostScript's dynamic name lookup than anything else.  

As for making a new dictionary every time a procedure is invoked,
that's the only way to use local variables in a recursive PostScript
procedure.

Oh, for a lexically scoped PostScript.
joe