Follow

It would be so easy to make a binary format for dotgrid, but no, plain-text, PLAIN-TEXT, the things I do do do for plaint-text.

· · Web · 7 · 3 · 14

@neauoire binary is a gun that will only shoot if you aim it at your foot.

@jameschip @neauoire Don't be afraid of binary data. It means you can't edit it in emacs as a text file, but it may make your application code so much more simple that you wouldn't believe it.

@cancel @jameschip well, my take was that if I can make a parser in just a handful of lines, then it's worth the trouble. The parser is tiny, and being forth-like really makes it a whole lot easier.

@neauoire @jameschip Yeah, of course. It depends on the thing. But blindly "always plain text" is a dangerous mental trap (in my opinion)

@cancel @jameschip I agree, I use plain-text sensibly. Dotgrid can already export in 2 different binary formats. But vectors is a great use of plain-text

@cancel @neauoire sure yeah in certain circumstances binary files can be great. Often though they can add unnecessary obscurity and complexity for really very little benefit. Also extensibility in binary formats can be a pain. At leat thats what I have learned from past experiences.

@cancel @jameschip @neauoire I've been having a really great time using SQLite as a file format for several of my projects: sqlite.org/appfileformat.html

Lots of things know how to read/write to a SQLite file. It's also super cool to be able to have two totally unrelated applications be able work together because they both use SQLite.

SQLite also has a way to dump everything to plaintext SQL statements as well, which actually compress quite well.

@neauoire
> wait, it's not json?
- some 21st century webdev somewhere

@neauoire it's not plain text if it requires a parser :)

@cancel huh, how do you call it when it's a plain-text format, but the file needs to be interpreted?

@neauoire yeah. I don't give "I want can do everything from my plain text editor" as much credence as many other people do. That's just my personal belief. Parsing human-formatted text strings, once the format has enough features, ends up making for ridiculously huge amounts of application code that could be shortened if it were in a more simple binary format.

@neauoire So I think "plain text" for configuration files with a simple format or other really simple things is fine.

@cancel but a configuration file needs to be parsed, so that's not really plain-text either

@neauoire yeah, it's really not, by my own personal highly-restrictive definition. Unless you are reading it to see what it does. If it's plain enough that you can figure it out then I guess that would be plain text.

@neauoire But something like YAML with loops and embedded escaped binary data and schemas... is that plain text?

@neauoire I guess my own definition of a purely plain text file is, like, a .txt file that's just meant for humans. Which is really restrictive, so maybe not that useful. But XML is also stored as "plain text", and so are a lot of other crazy things... is C code plain text? It's stored as text, but you have to treat it in a special way to do stuff with it. I looked up the definition on Wikipedia and other places, and there's a lot of disagreement apparently :P

@cancel something can be both plain-text and a mess.

Do you think this is plain-text enough?

@neauoire OK good question. I don't know the answer.

I can't visualize what it will look like by just reading the text.

But it's also a really simple format.

@cancel okay, so the threashold is when it stops being human-scale(unpredictable)

I can get behind that

@neauoire Yeah maybe! Like for example, I think Markdown is still "plain text", even though you can interpret it to another output, because it's still useful & usable in its raw format.

@cancel @neauoire So to invert your definition, it’s plain text if a human doesn’t need a parser to make some sense of the contents, as a human.

@neauoire But the "keep it a text file you can edit in vim or emacs at all costs" thing gets out of control and becomes a hindrance. Probably around the time you need to add escaping.

@neauoire while on that subject, do you create your own extensions based on the piece intent of the file ? Or just basic text ?

I noticed Oscean used tablatal/indental but I'm not sure if that's one of your creations ?

@morgan yeah tbtl/ndtl are my file formats, and for dotgrid I made something custom too.

I usually prefer to design a custom format, than adapting my needs around something that already exists. It teaches me about implementation and usually advises the format itself, as to keep things simple

@neauoire you can define a direct translation from strings to binary. Without complex parsing, like, read token until newline, strcmp with database, output binary code that can be interpreted by your tool. This way you have a intermediate binary machine language and a more high-level assembly language without labels and variable names

@sirjofri yeah that's what I didn't want to do, I've done that recently for GyoVM, but for dotgrid it has to be human-readable and unobfuscated.

It uses a forth-like language so it's the best of both world, the source text parser is only 40 lines of C89, and I'm not even using the strings library.

@neauoire yes the language I see in your other toots. It seems so simple, I would also just parse it directly.

Sign in to participate in the conversation
Merveilles

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.