Hello, fellow devs!
I'd like to share with you with a json-like text format for serialization and configuration files.
Current state & Usage
I wrote it as a part of my tech stack for game development in Nim. Currently it is used for describing game objects, engine settings and other configurable stuff. By far the Nim implementation works pretty fine for me, though I suspect it can be rough on edges. I never did such work before so maybe implementation could be better and I would write it cleaner if I sit down coding it now.
Examples
Unit = (
name = 'Alain'
pos = (x=5,y=10,z=0)
power = 90
cost = 10
kind = 'Mage'
items = [['book'='Homilies and Meditations']];
friends = ['Roland','Cuthbert']
dead = true
)
Another valid form:
(
Unit
.name = 'Alain';
.pos.x = 5;;
.pos.y = 10;;
.pos.z = 0;;
.power = 90;
.cost = 10;
.kind = 'Mage';
.friends = ['Cuthbert','Roland'];
.inventory = [['book'='Homilies and Meditations']];
.dead = true;
)
Interesting. Is there some sort of specification for the format? For example, from the examples, it looks like it distinguishes between (named)tuples and dictionaries/hashes/tables/whatever-you-call-them? How do you have strings with embedded single quotes? Is there a binary data type or base64 en-/decoding support?
While I'm not sure the world was holding it's breath for yet another object serialization format, it may be useful, if you need a close mapping to the Nim typesystem.
Hi, thanks for the feedback and yeah, I agree with you that it's not something world awaits XD But, it's interesting work and good exercise to say the least. I learned a lot from that.
Currently, I didn't thought about embedded single quotes nor binary data type, though I did tree model nodes for pods. You can easily do something like and receive specific data.
var width = mypod["app.window.width"].val(int)
echo width