-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I guess we're making a semi-blessed JS TOML parser for the website! #2
Comments
Or... We can drop that section. 🙃 I'm ambivalent to whatever we do here. |
haha That's a possibility too. The reason I added it was when I start comping I wanted to include the TOML vs JSON vs YAML examples. I found a converter (first or second result in google for "toml converter") and I thought "the first result should be toml.io, not some random site". But that was probably my vanity speaking, not the pragmatic/lazy programmer speaking. ;) |
I wouldn't mind dropping that section. If we're pitching a human-readable, human-writable format (and we are), then letting people see what they can do, and letting it tumble around in their head for a bit, is what's important. The rest of the site can point them to the latest spec, solid implementations, and maybe live demos. |
Aw, OK! It is definitely more of a nice-to-have. Though, of nice-to-haves, maybe "an automatic TOML validator" would come first, which is really just folding instaparse.mojombo.com into toml.io. |
Closing, since we've dropped that section. :) |
Following up on this:
Originally posted by @cannikin in #1 (comment)
We can do "lossy data, but structural match" or "lossy structure, but data match" translation across JSON : TOML, the data-lossless one involving type annotations embedded in the JSON structure. By default, we can favor the first, cleanest translation (where JSON and TOML are 1 to 1), but when the translation would involve loss of type data like that, we can display an error state or perhaps a "warning state" I guess and point the user to an option to enable alternative translations. After all, we already have to intelligently handle JSON literals ("Uh, Ma'am, this is a hash table").
I think recognizing JSON strings that are exact matches for the subsets of the RFC3339 format that TOML supports and casting them to TOML datetimes is a sane default, because it's lossless as a result, but not if they are off by even a single whitespace(!), and that a similar logic of Maximal Strictness would serve well on all type casts. No guessing and no magic, really, just return to user and comment on the results, maybe offer choices if we can. And I think that's going to be easiest.
Edited: I'm so sorry, I was mid-way through my coffee when I first posted this.
The text was updated successfully, but these errors were encountered: