Tyru wrote:
> Sorry Bram, I forgot to send this mail to vim_dev.
> Send again with +alpha about problems of current JSON features.
>
> On Sat, Feb 6, 2016 at 11:50 PM, Bram Moolenaar <[email protected]> wrote:
> >
> >> What do you think about this?
> >
> > I don't want to spend much time discussing this. v:null and v:none are
> > needed just like JavaScript has null and undefined.
> >
> > I was thinking of taking this a step further to a more efficient
> > encoding that is similar to Javascript. Unfortunately I haven't been
> > able to find a specification. I thought it was used in combination with
> > protocol buffers. Besides empty entries in an array, it also removes
> > the quotes around object item names. It's more efficient and doesn't
> > drop any functionality. We could add protocol buffer support, but let's
> > leave that for some other time.
> >
> > Also keep in mind that when you want to stick to the JSON standard
> > (well, one of them), you should not write the string yourself but use a
> > library to create it. Arguments that it's hard to type or spot a
> > mistake are hardly relevant.
>
> Okay.
> Now I know you seem to follow JavaScript syntax rather than JSON standard.
True. Perhaps we should split this and add jsencode() / jsdecode().
> But please remind JSON is not only for JavaScript.
> It might be used for a communication with Vim and scripts, external
> commands, and so on.
>
> And more, currently, 'jsonencode({"key": v:none})' produces output '{"key":}'.
> This is not even a correct JavaScript syntax.
I'll fix that.
> And as ZyX said, please delegate the role of human readable format to
> other formats, like YAML.
> JSON should do just a communication work with something outside Vim.
YAML has its advantages and disadvantages, I don't like it for
inter-process communication.
JSON is a nice format in many ways, although the requirement for quotes
isn't that nice.
> > you should not write the string yourself but use a
> > library to create it.
>
> Hmm, why?
To avoid mistakes. But you can create the strings manually if you want
to, that's the advantage of using JSON over a binary format. Easier for
debugging too. And for writing tests.
--
hundred-and-one symptoms of being an internet addict:
159. You get excited whenever discussing your hard drive.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.