PostScript Control Structures (2003)
nedbatchelder.com
nedbatchelder.com
JS ended up being a compiler target anyway. Stack-based PostScript would have been fine for that and given the web a 15-year head start towards real applications and designs.
Of course Berners-Lee was familiar with DPS, since it was the display layer on NeXTSTEP and the original WWW was a NeXT app. The problem for Display PostScript was always Adobe's expensive and restrictive licensing policy. Worse but free beats sophisticated but proprietary.
(See also Sun NeWS, https://en.wikipedia.org/wiki/NeWS which suffered the same licensing fate)
Marrying that to a hypertext-document-system is another deal entirely. We're moving away from that, too, but at least there's enough of the corpose visible to contain the raging beast of SPAs and animations.
But, well, "based" leaves some room, and maybe something between HyperCard and DPS would've been the best of both worlds.
There was HyperNeWS - which was a HyperCard like environment written in Sun's NeWS PostScript based graphics environment.
I worked with HyperNeWS in the early 1990s and it was brilliant - I don't think NeWS had much of a security model (could well be wrong about this).
Edit: Because of the alleged difficulties of writing PostScript the HyperNeWS team created a C to PostScript compiler in PostScript:
(Speaking of whom: http://www.art.net/~hopkins/Don/hyperlook/index.html )
http://www.art.net/~hopkins/Don/hyperlook/HyperDraw.gif
One thing that was particularly neat was that you draw a shape (any shape) and paste it as the shape of a window.
For all that I dislike HTML tag soup, the language does a lot of things right. It's reflowable, it can be rendered at any resolution (even a text terminal, see Lynx), it's flexible enough to support any document structure, and it can be picked up quickly by any 12-year-old with a text editor and no previous programming experience (and that's how we got ourselves the quirky and fun 90s Internet).
You'd be hard pressed to find another document markup language that can do the same. TeX, maybe? Certainly not a graphics language like PostScript.
I have fond memories of using Lynx and third party CLI messaging apps for AIM, IRC, etc when installing Gentoo on my iMac in 2004 for my first foray into linux. X needed modifications to the Gentoo bootloader to run on my hardware so it took a month or so of assistance from people[0] on #gentoo IRC before I had GUI running. But my digital life was entirely accessible with the CLI apps and 'screen' for multitasking. Living and breathing CLI for that long really went a long way to helping me learn Linux (as well as suffering Gentoo's propensity to require make configure for everything and its excellent guides to choosing between innumerable compile-time customizations of each package).
Nowadays that's very hard to do as iChat's XMPP has been replaced by iMessage's very closed system, IRC certainly isn't dead but Discord has taken front-and-center for many communities of high-interest, and websites are essentially impossible to navigate in CLI.
It's not necessarily a problem with HTML, but it is a "problem" with so much being moved to React / SPA architecture. A niche problem, to be sure. But it makes me sad that other young netizens can't have the same opportunities that I did.
0: Shoutout to Joseph Jezak ( https://developers.google.com/open-source/gsoc/2006 , https://blogs.gentoo.org/josejx/ ) -- your selfless help that summer sincerely changed my life.
Eventually, as more people got hypertext browsers, many desktop applications began to be distributed instead as client-side interactive PostScript documents, eschewing the NeWS network protocol altogether in favor of PSON, a text-based protocol which had the advantage of working correctly through corporate firewalls.
Someone developed a server-side runtime engine called Node.ps, and many people jumped on the bandwagon, claiming that it made sharing code between the client and server much easier. As PostScript development became more complex, preprocessor tools began proliferating, including a strongly-typed version of PostScript, known as TypeScript, which had a sophisticated type system that could handle the often-tortured function signatures of library authors.
Due to PostScript's lack of a good standard library, a company named "PPM" started a package repository, which was soon filled with tiny libraries for each PostScript procedure. This eventually lead to the “string-length debacle” when an upset developer unpublished a five-line package...
you have made my day :)
I'm very curious about the form and content of the "PSON", which could actually contain a program that would output PostScript. But I like this universe where all the time I spent on PostScript hacking would be useful now.
Just for fun, here's MDN's JSON example turned to PSON:
[
<<
/name (Molecule Man)
/age 29
/powers [ (Radiation resistance) (Turning tiny) ]
/inAlliance false
>>
<<
/name (Madame Uppercut)
/age 39
/powers [ (Million tonne punch) (Superhuman reflexes) ]
/inAlliance true
>>
]1. PDF has an "object table" so that you can refer to objects by number, permitting random access to the object graph, instead of requiring the whole file to be parsed from end to end.
2. PDF does permit comments, because not permitting comments would be a stupid idea.
3. PDF page contents are not represented as just a PSON object, but rather as a sequence of drawing operations.
By way of example, here's object 1750 from a random PDF file, which you can read in exactly the same way as your example above (so 37/T is two tokens: the integer 37 followed by the symbol T):
1750 0 obj
<</Linearized 1/L 791096/O 1752/E 12322/N 37/T 790286/H [ 483 540]>>
endobj
And here's some of the page contents from the same PDF, decompressed with Python zlib.decompress: 0.001 Tc -0.005 Tw -10.747 -1.02 Td
[(I)2(n)2(vest)1(men)2(t)1( )1(Co)2(n)2(f)1(eren)2(ce)]TJ
The TJ operator, as you can maybe guess, typesets a list of text strings interspersed with kerns, at the current point in the current font and so on.With the explicit dictionary stack, couldn't that be used to sandbox the scope and reach of these procedures?
And for reference a properly architected applicaton system would start with a virtual machine designed for hostile input at the bottom, net requests would be a first class system call and the applications could be written in whatever language you want. if you were particularly insane your entry point could be something as stupid as "#!/dns/org/gnu/gcc4 mass of hideous c code here" but usually would be "#!/dns/com/sun/java/java4" or "#!/dns/org/python/python3"
and before anybody shouts webasm... no, webasm is stupid, you are now trying to jam another application system on top of the document system "lets build the virtual machine in javascript and use it on top of all the existing browser madness" is not a good solution.