Takuya Fujiwara wrote:

> >> >> 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.
> >>
> >> Thanks!
> >> Now I confirmed that 7.4.1269 raises an E474 error for the expression.
> >> But yet it seems to return the string ('{"key":}').
> >> Is it intentional?
> >
> > When there is an error it returns what it has.  Would it be better to
> > return nothing?
> 
> Hmm, patch 7.4.1270 seemed to fix this temporarily last night
> and the result was totally what I was thinking;
> which returns 'v:none' instead of what it has.
> 
> An explicit error return value is better I think
> because immediately we can notice something went wrong.
> and if only a user checks the return value (without surrounding :try ~ 
> :catch),
> a user can detect an error, like 'delete()' returns -1 with an error.
> 
>     let json = jsonencode({"key": v:none})
>     if json is v:none
>         echoerr 'error!'
>         return ...
>     endif

Well, let's just return an empty string.  Returning a different type
often makes it more complicated.

> And sorry, tyru is a nickname.
> The real name is Takuya Fujiwara.
> I think you prefer a real name :)
> (changed my nickname on google groups, too)
> (oh, ':helpgrep Tyru' also shows my nickname in some places...)

Yes, I do prefer real names.  Thanks.

-- 
hundred-and-one symptoms of being an internet addict:
166. You have been on your computer soo long that you didn't realize
     you had grandchildren.

 /// 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.

Raspunde prin e-mail lui