Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1584

Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!!

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Helge Blischke <h.blischke@acm.org>
Newsgroups comp.lang.postscript
Subject Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!!
Followup-To comp.lang.postscript
Date Fri, 23 Aug 2013 16:37:37 +0200
Lines 48
Message-ID <b7padjFj02tU1@mid.individual.net> (permalink)
References <5a1784ab-352f-403e-878d-39740b1b23cd@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding 7Bit
X-Trace individual.net zHQZFwj4VgWB/q9tcm9kzAcJ3TdAHfD+NoZas617vP4abDiKQZ
Cancel-Lock sha1:DJotj4BV9CFLcUb1y62uCgGfQWk=
User-Agent KNode/0.99.01
Xref csiph.com comp.lang.postscript:1584

Followups directed to: comp.lang.postscript

Show key headers only | View raw


luser- -droog wrote:

> I've marveled at this behavior before. But I just can't imagine how
> they do that!
> 
> I suppose in many languages (PERL, Lua, JavaScript), the distinction
> between ints and reals is very blurry all the way down the pipeline.
> But postscript makes them distinct types for many operations
> (array and string indexing, stack indexing, various other 'count' or
> ordinal data), but blurs them during math. And C makes the distinction
> very explicit, but permits 'usual implicit conversions' to provide
> automatic promotions where appropriate.
> 
> All of this is fine, and where an operator needs one or the other
> it can check and signal an error; or when an operator can accept
> either, it can check and promote if necessary before merging
> the int and real cases. But...
> 
> But how do you make them hash equally so you can look them up in a dict?
> 
> My only guess is that ghostscript must merge them somehow into a single
> canonical form: some kind of extended floating-integer hybrid super-duper
> hackjob type.
> 
> But then, how do you do the 'super-duper' part?

Integers and reals don#t seem to be equivalent as dictionary keys.
For instance, if you define (in Ghostscript)

/1 (Heureka) def

currentdict/1 .knownget

puts 
(Heureka) true
onto the operand stack, but

currentdict/1.0 .knownget

yields only

false

on the operand stack.

Helge

Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How does ghostscript make ints and reals equivalent as dictionary keys??!!! luser- -droog <mijoryx@yahoo.com> - 2013-08-22 22:38 -0700
  Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! luser- -droog <mijoryx@yahoo.com> - 2013-08-23 00:06 -0700
  Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! Helge Blischke <h.blischke@acm.org> - 2013-08-23 16:37 +0200
    Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! luser- -droog <mijoryx@yahoo.com> - 2013-08-23 09:15 -0700
  Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! Ross Presser <rpresser@gmail.com> - 2013-08-23 10:40 -0700
    Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! luser- -droog <mijoryx@yahoo.com> - 2013-08-23 10:54 -0700
      Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! luser- -droog <mijoryx@yahoo.com> - 2013-08-23 10:57 -0700
        Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! Ross Presser <rpresser@gmail.com> - 2013-08-23 11:20 -0700
          Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! luser- -droog <mijoryx@yahoo.com> - 2013-08-23 11:49 -0700
            Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! luser- -droog <mijoryx@yahoo.com> - 2013-08-23 22:57 -0700
              Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! luser- -droog <mijoryx@yahoo.com> - 2013-08-24 12:24 -0700
                Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! luser- -droog <mijoryx@yahoo.com> - 2013-08-25 22:38 -0700
          Re: How does ghostscript make ints and reals equivalent as dictionary keys??!!! luser- -droog <mijoryx@yahoo.com> - 2013-08-23 12:08 -0700

csiph-web