4 ms·
> including a strongly-typed version of PostScript, known as TypeScript you have made my day :) I'm very curious about the form and content of the "PSON", whi
by an1sotropy 4y ago
> including a strongly-typed version of PostScript, known as TypeScript
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.
- wolfgang42 4y agoI’m imagining PSON as the alt-universe equivalent of JSON, where it uses a reduced version of the syntax that can only represent data, not execute instructions. So you’d get /symbols, (strings), << /Key (value) >> dicts, [ (arrays) (of) (items) ], numbers, and booleans, but no { procedures }, % comments, or operators. 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 >> ]
- kragen 4y agoPSON as you're describing it is basically PDF, with a couple of differences: 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.
- an1sotropy 4y agoRight; PDF is just a static record of whatever got generated by executing a PostScript program. So it doesn't try to represent anything about the PostScript program itself, which is why I was idly curious about PSON as a container for programs.
- DuncanMak 4y agoWith PostScript being one of the few successful "mobile code" systems out there, I wonder if PSON will do better than JSON by allowing { procedures }. With the explicit dictionary stack, couldn't that be used to sandbox the scope and reach of these procedures?