[comp.windows.news] implementation of inheritance within PostScript

marshall@software.ORG (Eric Marshall) (07/15/88)

	Did Sun extend PostScript to incorporate inheritance,
or do the NeWS operators used to implement inheritance only need
PostScript's predefined dictionary semantics?

Thanks in advance.


Eric Marshall
Software Productivity Consortium
1880 North Campus Commons Drive
Reston, VA 22091
(703) 391-1838

CSNET: marshall@software.org
ARPANET: marshall%software.org@relay.cs.net  OR
         @relay.cs.net:marshall@software.org

elwell@ichthyosaur.cis.ohio-state.edu (Clayton M. Elwell) (07/15/88)

marshall@software.ORG (Eric Marshall) writes:
    
    	Did Sun extend PostScript to incorporate inheritance,
    or do the NeWS operators used to implement inheritance only need
    PostScript's predefined dictionary semantics?
    
It's pretty slick--they use just plain ole PostScript.  Basically,
objects are dictionaries, and the dictionary stack is used to handle
inheritance.  Methods are invoked with an explicit 'send' call, as in:

	framebuffer /new DefaultWindow send

which calls the 'new' method of the object (class) DefaultWindow.  By
the time the method gets control, the operand stack is cleaned up, so
the value of 'framebuffer' is available as an argument to the method.

There are some performance hacks that take advantage of the fact that
procedures in PostScript are really arrays deep in their hearts, and
thus can be taken apart and put back together differently, but it's
all strictly by the book (the red one, in this case).  If you want to
do object-based stuff on your printer, it'll run...


Clayton M. Elwell <elwell@tut.cis.ohio-state.edu>
Ohio State University CIS Dept. Research Computing Facility

"... there was a *third* possibility that we hadn't even counted
upon ..."		--Arlo Guthrie, "Alice's Restaurant"

gregm@SUN.COM (Greg McLaughlin) (07/15/88)

>	Did Sun extend PostScript to incorporate inheritance,
>or do the NeWS operators used to implement inheritance only need
>PostScript's predefined dictionary semantics?
>
>Thanks in advance.
>
>
>Eric Marshall
>Software Productivity Consortium
>1880 North Campus Commons Drive
>Reston, VA 22091
>(703) 391-1838


The NeWS implemetation of inheritance only needs PostScript's predefined
dictionary sematics. At last check (about 1 year ago), if you run the NeWS
classing code through a LaserWriter it works fine. You can look at all the
code that is used in /usr/NeWS/lib/NeWS/class.ps.

Recently for 1.1 we implemented 'send' in C for performance, but class.ps
still contains the original implementaion of send.



Greg McLaughlin
Sun Microsystems Inc.