tags:

views:

94

answers:

2

Question: Do you have any suggestion for better names for these functions?

Since newpath and stroke causes the current point to become undefined I usually define procedures like

/new_path     { currentpoint newpath moveto             } bind def
/close_stroke { currentpoint closepath stroke moveto    } bind def

However these names are really examples of How to write unmaintainable code, and I would rather like to call them something else but cannot come up with any good names (other than maybe something like newpath_without_undefining_currentpoint and then the benefit of using a procedure is more or less gone).

Searching for existing usage only came up with the following in pdf_ops.ps from ghostscript:

/tn { currentpoint newpath moveto } bdef % Obsolete, never used.

and tn is not exactly a better name.

Edit: What I mean by having unmaintainable characteristics is that I end up with newpath and new_path, both doing the same thing but slightly differently and there is nothing in the names giving anything hints about anything. I know that identifiers often are kept short to save space, but this is not an issue for my hand written files.

A: 

Your names look good to me. I'd hazard a couple of mine -- /newpath_here and /stroke_here.

tn is not exactly a better name.

The short names are a fallout of an effort to keep the PS file size small (less number of bytes means less stuff to transmit over the wire). In fact, this is shared even by PDF's operators (where the connotation changes with casing).

dirkgently
+1  A: 

How about using /beginpath (or /startpath) and /completepath?

tvanfosson
Good suggestions. I will think a bit about them.
hlovdal