News for hackers. Stuff that matters.
Re:TinyVG: A challenger to the throne of vector graphics by ikskuh on Monday December 20, 2021 @04:26PM (#29630516)
Then you should check out the TinyVG text format:

(tvg 1 (32 32 1/1 u8888 reduced) ( (1 0 0) ) ( (fill_polygon (flat 0) ( (16 0) (32 32) (0 32) )) ) )

This draws you a tiny triangle. The only problem you'll get is when doing text, but for SVG: These wouldn't be portable anyways

Re:TinyVG: A challenger to the throne of vector graphics by shatteredgate on Monday December 20, 2021 @04:59PM (#29630890)
Am I the only one who dislikes S-expressions and prefers XML or JSON or even YAML? The parenthesis are way too confusing when editing manually and the format doesn't have enough semantic information to always correctly parse into common structures in any language besides lisp. I enjoy writing lisp myself but I really think it is a mistake to use them for common formats everywhere that I've seen it tried.
Re:TinyVG: A challenger to the throne of vector graphics by hayley-patton on Tuesday December 21, 2021 @03:00AM (#29635068)
I'm not a fan of the usual uses of S-expressions in data formats, but for quite the opposite reasons. People seem to have a thing for making up new syntax, so you can't just throw a normal S-expression parser at the problem, and be done with it. For example, the wasm2ps reader [1] has to know how to read a comment in the WebAssembly text format. I decided to leave the project at handling integer instructions and control flow only, as there are other oddities like using a single atom for alignment and offsets in load and store instructions [2]. Some people I've talked to wished that people would stop inventing ad-hoc syntaxes, and just use S-expressions or something. Using S-expressions but adding more ad-hoc syntax gives you the worst of both options.

While admittedly less of a problem for implementation, it is also annoying to see lists with dangling parens on their own lines, and symbols with underscores or camelCase in the names, once you are used to the normal way of formatting Lisp code.

[1] https://github.com/no-defun-allowed/wasm2ps/blob/master/Code... [2] https://github.com/WebAssembly/spec/blob/master/interpreter/...

Re:TinyVG: A challenger to the throne of vector graphics by templix on Monday December 20, 2021 @05:49PM (#29631511)
You enjoy writing Lisp, but somehow find parenthesis way too confusing when editing manually? That's pretty hilarious.

If you take the expression above and format it in any half-decent editor, it's pretty clear. YAML is a shitshow, JSON is yuck and let's not talk about XML.

Re:TinyVG: A challenger to the throne of vector graphics by shatteredgate on Monday December 20, 2021 @06:53PM (#29632066)
Yes, I enjoy lisp the language and its constructs but I don't enjoy the parenthesis or the syntax. What's hilarious about that? I'm sure you could list some aspects of lisp that you don't like if you have a lot of experience with it.

>YAML is a shitshow, JSON is yuck and let's not talk about XML.

My issue with S-expressions as a data exchange format is that they're actually just the worst aspects of all three of those combined. If you're frustrated by XML having really deep trees and only having strings and elements as datatypes, then S-expressions are just as bad, reliably they only really have strings and lists as datatypes and the trees tend to have even deeper nesting than XML. For JSON the formats are equivalent if you remove everything from JSON except lists and strings, so S-expressions are strictly a worse subset, they're just as yuck. YAML is bad because it's complex and badly specified but S-expressions are still worse of a shitshow because there is no spec. You just have to hope the format you used is compatible with your Lisp implementation. And yes this has caused me problems where using "read" on S-expressions with certain characters in them or in certain encodings completely breaks on some Lisp implementations. If you're using some other language that isn't Lisp and you're rolling your own parser then good luck having that be compatible with anything, most parsers I see just pick a random Lisp implementation and aim for compatibility with it which is still not reliable.

The only good thing I can say about S-expressions is that they're quite easy to spit out from a bash script, but for this problem domain (vector graphics) there is an even easier option: use a very simple command-based format like postscript.

Re:TinyVG: A challenger to the throne of vector graphics by mro_name on Tuesday December 21, 2021 @03:34AM (#29635267)
XML and YAML (including it's JSON representation) are complexity nightmares. But especially for xml, the tooling makes them appealing to use as e.g. distribution format with JS-less browser templating.
Re:TinyVG: A challenger to the throne of vector graphics by dnautics on Monday December 20, 2021 @05:03PM (#29630933)
seriously, it shouldn't be so hard to write a parser that compiles your favorite text format to TVG, or even to the lispy text format.
Re:TinyVG: A challenger to the throne of vector graphics by shatteredgate on Monday December 20, 2021 @05:05PM (#29630957)
IMO that defeats the purpose of using this format if you have to write things to compile to it. If you do that you might as well just compile to the binary format since you won't be editing your canonical representation anyway. I'd imagine with image formats you'd want to pick a format that is the easiest possible thing to parse and consume while not harming it's "editableness" and I don't think S-expressions fit that bill.
Re:TinyVG: A challenger to the throne of vector graphics by dnautics on Monday December 20, 2021 @06:49PM (#29632030)
Tvg is a binary format? It's not really human readable. Compiling to it is a natural thing to be doing.
Re:TinyVG: A challenger to the throne of vector graphics by shatteredgate on Monday December 20, 2021 @07:01PM (#29632118)
Sorry, was responding to the last part of your sentence.
Re:TinyVG: A challenger to the throne of vector graphics by mro_name on Tuesday December 21, 2021 @03:31AM (#29635249)
S-expressions, finally! Thanks!