[comp.windows.news] bug or feature?

deven@hbo.UUCP (Jimmy G. Devenport) (05/05/90)

ok, I ran across this one while I was defining a new item which has about 3
ParentClasses and got a little mixed up (?) and everything looks fine but
it gets an error:

/InputItem currentdict /errorproc
   (Label:) () /Right /notify 
   ObjectCanvas InputWidth 0 /new OneLine send
store

now everything as far as I know was looking great, I had all the comments to
show what was on the stack at all the /new's all the way back to the subclass
of TextItem (defined in $OPENWINHOME/lib/NeWS/liteitem.ps), BUT this is what
happened:  InputItem was left undefined!  This is easy to fix , but what
WAS defined?  while looking for the error, and using (NeWS/debug.ps) to catch
the error about InputItem being undefined and then looking at the current
dictionaries and seeing what was on the dictstack ( "0 dictstack" ), I found
something like this:

(on the stack)
dict[
    ...
    <dict stuff>
    ...
    dictionary[43/5000]: dictionary[51/5000]
    ...]

now what's wrong with this?

ok go into either NeWS 1.1 or NeWS 2.0 (this was under 2.0) and define a
window or something or even look at systemdict and you should find that the
dict[num]: dict[num]   are both the same, ie not dict[num]: dict[someothernum]

now how did this happen?  I tried messing around in psh trying to get it to
happen and did something like this:

hbo% psh
executive
Welcome to NeWS 1.1
/dict1 30 dict def
/dict2 50 dict def
userdict pstack
dict[
    /dict2: dictionary[20]
    /execfile: file(?,W,R)
    /bye: {'quit'}
    /OriginatingHost: (hbo)
    /dict1: dictionary[62]
    ]
dict2 dict1 def pstack
dict[
    dictionary[20]: dictionary[62]
    /dict2: dictionary[20]
    /execfile: file(?,W,R)
    /bye: {'quit'}
    /OriginatingHost: (hbo)
    /dict1: dictionary[62]
    ]

quit...

now the previous psh was under NeWS 1.1 but in NeWS 2.0 it's the same (that's
where I got the bug in the first place), and the question is why does it do
and what's the purpose of defining a dictionary to be another dictionary?
and where or how do you or can you get this "literal" (the one on the left)
dictionary? also what is the purpose of having something like this? is this
what PostScript does?  Is there any real documentation or "look out for this"
stuff anywhere?  and what is the purpose of having in a dictionary a key that
has the dictionary defined as being the dictionary? ie:

dict[
    ...normal dict stuff
    dictionary[length]: dictionary[length]
    ]

why is NeWS defined this way and are there any special bugs we haven't heard
about if these are undef'd (and how do you get rid of them, are they really
needed?) ???  and could there be an error defined somewhere that handles this
(in a future release of NeWS) ?  or maybe I don't know what I'm talking about
because it's really not documented....?

pretty strange bug?

     Jimmy G. Devenport
     Applied Computing Systems
     2075 Trinity Drive  Suite Lower Level (the dungeon)
     Lost Almost, NM  87544
     (505) 662-3309
     hbo!deven@atlantis.ees.anl.gov

jd

rxb@ASC.SLB.COM (Rafael Bracho) (05/08/90)

I got confused by your message, but I think you're objecting to the fact
that dictionaries can have other dictionaries as keys.  This is
specified in the red book, page 30, in the second paragraph of the
'Dictionary' section:

	"Keys are normally name objects; the PostScript syntax and the
	interpreter are optimized for this most common case.  However, a
	key may be any PostScript object except null ..."

So NeWS is simply complying with the red book.

					-Rafael