ianremmler / shor

Simple hierarchical ordered representation for data.
MIT License
0 stars 0 forks source link

Wishlist: encoding/* style API #1

Open tv42 opened 10 years ago

tv42 commented 10 years ago

The benefit of decoding into a struct is that 99% of my code can just access the struct, and not need to know it's using shor. Imagine migrating from json to yaml to shor; the json->yaml part is a tiny change, to switch to the current shor library would mean rewriting large chunks of the rest of the app.

ianremmler commented 10 years ago

I considered that initially, but since shor doesn't map well directly to native types (because of the ordered, repeatable keys mainly) I skipped it for now.

The two options I can see are:

I suspect the former would be more trouble than it's worth. The latter would get you the shor syntax without the other stuff, but it would look a lot like rjson, which already works. Let me know if I've missed any options.

Shor was mainly an experiment in designing an expressive data language with simple syntax, but I haven't used it for anything practical since making it. If you have ideas for making it more useful, please let me know.

ianremmler commented 10 years ago

Oops, accidentally closed.

tv42 commented 10 years ago

Yeah, I guess rjson does look better for that use.

What I really want is something like shor and rjson that can incorporate multi-paragraph text blurbs without excessive quoting, and ideally avoid needing to quote string values too. YAML still shines there, ogdl cames close as a syntax but the implementation just isn't quite there.

ianremmler commented 10 years ago

Did you happen to see my other language experiment, doggerel? It's pretty dumb and strict (commands have to start in the first column, anyone?), but it's designed to represent structured texty documents with minimal markup. And it will round-trip, including comments, which is something I miss in other languages.

tv42 commented 10 years ago

No, I didn't. The "=" thing makes me think those look almost like markdown headers, which would play well with the prose parts. The ":key here: value" thing is what reStructuredText does, and I'm not too fond of it as a syntax, there; I started down this road to minimize punctuation.

I'll keep experimenting. Thanks.