Attention Former Programming Languages Students
Message from 2022
This post is pretty old! Opinions and technical information in it are almost certainly oudated. Commands and configurations will probably not work. Consider the age of the content before putting any of it into practice.
Last fall I took Dr. Albrecht’s awesome “Programming Languages” class at USF. On a whim today, I took a look at one of the postscript programs I had written.
Some parts I can understand readily:
(Grade Calculator by Bryce Kerley U-number) dup dup
.85 .90 1 setrgbcolor %spiffy watermark
-20 9.5 144 pt textdraw
0 0 0 setrgbcolor
2 10 12 pt textdraw %front and center
Some parts I remember fondly due to sheer smarmy cleverness (i.e. using the rgbcolor register as a loop index):
currentrgbcolor %load current color
dup 1 eq %if our blue was last filled up
{pop pop pop 0.4 0 0.4} if %darken it down to purple
3 1 roll %rotate it to the next primary or to brown/navy from purple
setrgbcolor
And some parts that I forgot to comment I don’t understand:
pop dup grades exch get
1 add exch
grades 3 1 roll exch put
true
So, if you’re working in a “puzzle language” like Postscript you might want to include more useful comments than you normally do.