Registration has been disabled and the moderation extension has been turned off.
Contact an admin on Discord or EDF if you want an account. Also fuck bots.

Forth

From Encyclopedia Dramatica
(Redirected from PostScript)
Jump to navigation Jump to search
Actual book cover.

Forth is a highly potent neurotoxin developed in the Soviet Union during the mid 1960s and injected into the spinal column of US Observatory worker Charles Moore. Under the influence of this highly toxic nerve agent, Moore's brain structure was catastrophically altered, causing him to start uttering meaningless words in reverse.

So ingenious was the Russians' biological weapon that Moore's colleagues, and later, much of the global IT community, came to regard the toxin as a programming language and, following Moore's lead, named it Forth.

Forth does indeed have application as a minimalist programming language well suited to resource-limited embedded programming applications. However, it tempts its programmer to take a one-way trip away from the real world into a profoundly autistic, anti-social schizoidal world from which he or she will never return.

At any time, there are k n implementations of Forth, where k is a constant greater than 3, and n is the number of currently active Forth programmers. When starting out on a programming project, a programmer invariably turns his or her attention to the language implementation itself, fine-tuning it along the way, and ultimately diving off onto the tangent of writing a whole new implementation, forgetting about the original project.

To give an example of how mind-damaging Forth can be, compare the following two code excerpts. They are both implementing a recursive Fibonacci function, with the first implementation in Python and the second one in Forth.

# Implementation of a recursive fibonacci function in Python

def fib(n):
    if n < 3:
        return 1
    return fib(n-1) + fib(n-2)

And here's the Forth version

\ This forth code is much more readable than average
: fib dup 3 < if drop 1 else 1- dup recurse swap 1- recurse + then ;

You can be assured that if you take more than a passing interest in Forth, you will never get laid again. You will lose your job, and be unable to get a new one. Eventually, you will be found living in a squat, surrounded by rotting garbage and vermin, writing completely useless Forth code on an 80486-based laptop. You won't be at all concerned, because you will have your basic Forth operating system working, and your Forth motherboard drivers mostly bug free, and your Forth window manager code coming along nicely. You will even have written a rudimentary TCP/IP stack and web browser, so you can post to Forth web forums about how gay everyone else's Forth implementation is.

Repercussions

Fortunately, this Soviet biological weapons attack on the fledgling American IT industry had only limited success. While it had devastating effects on a handful of victims in the "free" world, most IT workers escaped relatively unscathed.

PostScript

In the fullness of time, when the first massive laser printers were being designed in the 1970s, they were designed to be computers on their own, to give them the artistic brio for expressing the graphic design breakthroughs of DESKTOP PUBLISHING— swoops and curls and gradients and whirligigs, mathematical illustrations, and a single 250-point lowercase letter "a" filling the whole page, in Optima Bold Italic.

For reasons known perhaps only to warlocks and whores, the following approach was decided on: a file to be printed should be a program which, when run— in the printer— will draw the document on the page. But what language should these programs be written in? Lisp? Cobol? Bitch please. FORTH! Because if you're trying to debug a program that runs only inside a printer, how much worse could it be if that program is in Forth? And so Forth's flipper-armed demonspawn was named PostScript.

Here's PostScript code for the Fibonacci function from above, written all pretty-like:

/fib {
  dup 3 lt

    {
      pop 1
    }

    {
      1 sub dup
        fib exch 
	1 sub fib
      add
    }
  ifelse
} def

But that's just putting lipstick on a hog. This is really what you have:

/fib { dup 3 lt { pop 1 } { 1 sub dup fib exch 1 sub fib add } ifelse } def

If you need a reminder that this is really just Forth, here is the Forth code and the PostScript code, lined up:

:  fib     dup 3 <    if   drop 1   else   1-      dup
  /fib {   dup 3 lt    {   pop  1   }  {   1 sub   dup

recurse   swap   1-      recurse   +      then      ;
fib       exch   1 sub   fib       add    } ifelse  } def

If you make some function aliases, you can get even further back to Olde Forthe:

/; { def } def
/drop { pop   } ;
/1-   { 1 sub } ;
/swap { exch  } ;
/+    { add   } ;

...to get you to:

/fib { dup 3 lt { drop 1 } { 1- dup fib swap 1- fib + } ifelse } ;

...and so, lined up again:

:  fib     dup 3 <    if   drop 1   else   1-  dup
  /fib  {  dup 3 lt    {   drop 1   }  {   1-  dup

recurse   swap   1-   recurse   +      then       ;
fib       swap   1-   fib       +   }  ifelse  }  ;

(But really, this only ever comes up if you have time-warped into 1987 and are working for Corel and you discover that you need the Fibonacci sequence to finish the part of Corel Draw v0.0 that craps out the PostScript code for drop shadows. Otherwise stop thinking about stack languages and GTFO.)

When documents are programs (much less in Forth), you cannot tell what they'll do until you actually run them— even “how many pages is it?” can be a mystery. In the years that followed version 1 of PostScript, that issue very slowly came to be considered a bit of a bother, and so the subsequent versions of PostScript restricted and boxed in the language, until finally it was given a makeover and became PDF, where many of the same graphics primitives could be used, but no actual programming language was at work.

(Later it was deemed necessary to embed JavaScript in PDFs, because why fail once when you can fail fail again?)

Forth is part of a series on

Softwarez

Visit the Softwarez Portal for complete coverage.