Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!hoptoad!gnu From: gnu@hoptoad.uucp (John Gilmore) Newsgroups: comp.windows.news Subject: Structuring NeWS PostScript code Message-ID: <7440@hoptoad.uucp> Date: 26 May 89 04:58:45 GMT Organization: Grasshopper Group in San Francisco Lines: 28 I have a lot of trouble in reading existing PostScript applications for NeWS (such as the demos). Much of my trouble is an ongoing uncertainty about exactly what environment each chunk of code runs in. For example, some code runs in the "mainline" of the application, some in event handler processes, some inside "send"s, etc. I find that I have no easy way to predict what process something runs in, and/or what is on its dictionary stack when it runs. I am groping my way toward a discipline that would make applications more readable and understandable. The first step is to have most significant actions occur in the mainline code, by sending events from event handlers back to the mainline code. This eliminates a lot of race conditions and scope problems. A second step that I'm thinking about is to textually structure a NeWS application such that ALL the code that runs in a given process context is adjecent in the source file. The only interactions done across process boundaries would be done by passing NAMES across the boundary -- not chunks of code. I haven't tried this out yet. Any comments on the topic in general, or on my specific ideas? -- John Gilmore {sun,pacbell,uunet,pyramid,amdahl}!hoptoad!gnu gnu@toad.com A well-regulated militia, being necessary to the security of a free State, the right of the people to keep and bear arms, shall not be infringed.