Memoizing in PostScript
Bug

poperr leaves a null on the stack if errorstack is null. Better:

/poperr { 
    errorstack null ne { 
        errorstack aload pop  /errorstack exch store 
        exec put 
    } if 
}


This leaves the stack clean and makes extra calls to poperr harmless. If desireable, some action could be put in the else case but since this code is mucking about with error handlers, it is unclear whether signalling an error is correct here.