• Re: PostScript and its uses (Re: polyglot programming, Recent historyof vi)

    From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to alt.folklore.computers,comp.lang.misc on Thu Dec 18 00:40:46 2025
    From Newsgroup: comp.lang.misc

    On Wed, 17 Dec 2025 19:44:53 -0000 (UTC), Lars Poulsen wrote:

    PDF is just a wrapper around PostScript as I understand it.

    Not really. Part of its original design was to make it easy to send to
    a PostScript printer, prefixed by a suitable prelude, that is true.
    But a key point is that it leaves out all the programming-language
    stuff, and also adds explicit document structure (pages, links etc) as
    part of the format.

    Imagine a page with 3 instances of a “ball” object drawn on it at
    (x, y) positions (100, 100), (100, 200) and (100, 300). In PostScript,
    one way you could do this would be to use variables and control
    constructs:

    /ypos 100 def
    3 {100 ypos moveto ball /ypos ypos 100 add def} repeat

    Now suppose you wanted to move the second ball object to position
    (150, 200): How would you do it? The PostScript program is not a
    direct 1:1 representation of the editable objects on the page. To
    achieve this, you would need to write the code entirely differently.

    The PDF equivalent doesn’t allow variables or control constructs, so
    it would be more like (disregarding the actual operator details):

    100 100 moveto /ball Do
    100 200 moveto /ball Do
    100 300 moveto /ball Do

    Now you can see there is a 1:1 representation between parts of the
    document and objects on the page, so it is much easier to perform the
    required edit.
    --- Synchronet 3.21a-Linux NewsLink 1.2