2016-01-26 16:29 GMT+03:00 Bram Moolenaar <
Br...@moolenaar.net>:
>
> Yukihiro Nakadaira wrote:
>
>> :echo jsondecode('{"":"x"}')
>> E713: Cannot use empty key for Dictionary
>>
>> Will Vim allow empty key?
>
> Hmm, if you take the standard literally I suppose it allows for an empty
> key. In practice it's an indication something went wrong.
>
> Why are you asking, do you see a practical application for it?
In addition to diffing there is also caching: imagine function that
compiles PCRE regex into Vim regex (or fallback implementation for
glob2regpat() for older Vim versions). Using dictionaries for caching
is natural and empty pattern is also the valid one. I do not see why
this restriction exists in first place, most of dictionary
implementations allow empty strings simply because *not* allowing it
requires additional length checks which will not be written without a
good reason.
>
> The standard also allows for duplicate names, even though in practice
> that doesn't work. So even though it's valid JSON, it doesn't mean it's
> a valid value after converting from JSON to Vim types.
Standard states this is implementation-defined (though in place of one
sentence and using this exact term they have written a whole paragraph
with this meaning). In any case “internal error” is not something that
should be reported in this case, documentation explicitly states that
internal error is a bug.
> --
> --
> 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
vim_dev+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.