Xref: utzoo comp.lang.forth:553 comp.lang.postscript:960 comp.windows.news:779 comp.windows.misc:691 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!uwvax!oddjob!mimsy!brillig.umd.edu!don From: don@brillig.umd.edu (Don Hopkins) Newsgroups: comp.lang.forth,comp.lang.postscript,comp.windows.news,comp.windows.misc Subject: Re: type checking (I want PostScript) -- give NeWS a try! Summary: NeWS isn't just for Display -- it's for Interaction! Keywords: Forth, Lisp, Interactive PostScript, NeWS Message-ID: <13613@mimsy.UUCP> Date: 19 Sep 88 03:43:28 GMT References: <17702@glacier.STANFORD.EDU> <3566@druhi.ATT.COM> Sender: nobody@mimsy.UUCP Reply-To: don@brillig.umd.edu.UUCP (Don Hopkins) Organization: U of Maryland, Dept. of Computer Science, Human Computer Interaction Lab Lines: 99 Hey all you Forth enthusiasts (and antagonists!!!) out there: If you want a powerful flexible object oriented multitasking interactive PostScript programming environment, then get NeWS! NeWS officially stands for "Network extensible Window System", but once you see it in action, you'll realize that it really means "Neat Window System!" c(-; NeWS was written to be portable, and it currently runs on a wide variety of machine's: Silicon Graphics, Sun, Mac II (under AUX), PS/2 and other 386 boxes (under OS/2), and many other systems. I could go on and on about how great it is to have a window system with the high level, device independent PostScript imaging model, and how much fun you can have with arbitrarily shaped windows, and what a performance win it is to have an extension language built into the window system that can perform local input processing and feedback, and its profound impact on client-server network traffic, and what an interactive programming environment means for the rapid prototyping of user interfaces, but I'll leave such discussions for comp.windows.news. The issue here is PostScript, the *programming language*! (Like xerox, the verb ;-) PostScript is a cross between Forth and Lisp. Objects are typed, like in Lisp. PostScript procedures can be passed around as arguments on the stack, and manipulated like any other data type, since they're just executable arrays. (i.e. "if" takes 2 arguments: a boolean and a procedure to execute (if the boolean's true)) Arrays are polymorphic -- each element can be an object of any type. Dictionaries can be used like Lisp association lists or Forth vocabularies. To define procedures and variables, you associate names with executable arrays and other values, in dictionaries. The scope is defined by the contents of the dictionary stack, searched top to bottom. PostScript procedures can have named local variables just by pushing a new dictionary onto the dict stack, storing into it the arguments passed on the parameter stack, and other local variables, and popping the dict stack before exiting. Names in PostScript are more like atoms in Lisp than like words in Forth: they don't have value slots or parameter fields -- they are associated with values in dictionaries. To execute a name, it is looked up on the dictionary stack, and its associated value is executed. One thing that makes NeWS such a powerful environment is Owen Densmore's object oriented PostScript programming package. It provides a Smalltalk-like class mechanism, using the dictionary stack to implement inheritence. NeWS user interface objects such as menus, windows, buttons, and scroll bars are defined as classes. You can customize their look and feel by defining subclasses of these objects, saving time and reusing code by building on top of what is already there. The NeWS server is a MuLTiTaSKiNG PostScript interpreter, with an event queue, and a hierarchy of arbitrarily shaped overlapping drawing surfaces (canvases). Lightweight PostScript processes live together in the server, sharing code and data. Keyboard and mouse input generate events, which are put on the event queue and delivered to interested processes in the order that they happened. NeWS processes can communicate with each other by sharing data and sending events. NeWS provides monitors to synchronize access to shared data structures. You express interest in the types of event you want, and loop awaiting and servicing them. You can fork off processes to manage interactive objects, service events, do background processing, or whatever you like -- they're cheap! There is also a PostScript debugger that lets you enter broken processes, examine their guts, fix them up, and send them on their way. NeWS smoothly incorporates many important extensions to the PostScript language. Certain NeWS data types, such as processes, canvases, and events, behave just like dictionaries. You can even push them onto the dictionary stack. A process dictionary contains keys like /ExecutionStack, /OperandStack, /State, and /Interests, and a canvas dictionary contains keys like /Mapped, /Parent, /CanvasBelow, /Color, and /Retained. Reading and writing the values of these keys can have magical effects. For example, setting /Mapped in a canvas dictionary to true makes it appear on the screen; the /XLocation and /YLocation keys of an event are automatically transformed in terms of the current coordinate system. If you want to learn PostScript, NeWS is the way to go -- it's an exciting and gratifying programming environment! Don't waste your time trying to learn an interactive interpretive language like PostScript by spooling files to a laser printer. NeWS isn't just for Display -- it's for Interaction! You can take a look and feel for yourself, if you go to the Sun User Group Southwest Regional Conference in Albuquerque, on September 30th. I'll be demonstrating the HyperTIES hypermedia browser, and the UniPress Emacs text editor, two NeWS applications I've worked on that make extensive use of interactive PostScript. If you want to know more, send me mail or post questions to the "comp.windows.news" newsgroup (or the Internet mailing list "NeWS-makers@brillig.umd.edu"). (If you want to be added to the mailing list, please send me mail at the address "NeWS-makers-REQUEST@brillig.umd.edu".) -Don don@brillig.umd.edu ...!uunet!mimsy!don