vital.vim icon indicating copy to clipboard operation
vital.vim copied to clipboard

WIP: Web.JSON improve to v8

Open Milly opened this issue 6 years ago • 6 comments

Web.JSON is too old. Update to vim 8.

...But since json_encode() already exists, is this module unnecessary?

This PR includes these new featues.

  • 'allow_nan' setting.
  • 'ensure_ascii' setting.
  • 'from_encoding' setting.

Milly avatar Nov 11 '19 06:11 Milly

From my point of view, at least this module should keep backward compatibility while

  1. People should use json_encode() instead as you said
  2. That's why there is no positive reason to improve this module
  3. Code which uses this module uses this module may because of some reason

lambdalisue avatar Nov 12 '19 00:11 lambdalisue

  1. People should use json_encode() instead as you said

Vital.vim is currently (basically) support vim 8.0 or later. So should this module be deprecated? Write to document "deprecated" and "should use json_encode()"?

  1. That's why there is no positive reason to improve this module

I'm thinking of an implementation that makes the JSON module more flexible like Python's JSON Library. json_encode() is not-strict and not-flexible. Should this be a separate module? (eg. Data.JSON or ...)

  1. Code which uses this module uses this module may because of some reason

Agree

One thing, These are purely bug fixes.

  • Convert control chars. (Encoded invalid JSON)
  • Convert UTF-16 surrogate pairs. (Can not decode valid JSON)

Milly avatar Nov 12 '19 03:11 Milly

So should this module be deprecated? Write to document "deprecated" and "should use json_encode()"?

Yeah, I think so but it's just my opinion. Actually, I'm more welcome to remove this module rather than improve/fix because of existnace of json_encode().

I'm thinking of an implementation that makes the JSON module more flexible like Python's JSON Library. json_encode() is not-strict and not-flexible. Should this be a separate module?

Got it. Well, then I think it's better to

  1. Use different namespace as you said (I'm OK with Data.JSON)
  2. Remove any codes for backward compatibilities and explain the benefits of using Data.JSON over json_encode() or whatever in help
  3. Apply bug fixes to Web.JSON (Optional, if you desire)

lambdalisue avatar Nov 13 '19 11:11 lambdalisue

I'm created #743 that part of bug fixes of this PR.

Milly avatar May 21 '20 07:05 Milly

Closed by https://github.com/vim-jp/vital.vim/pull/743 ?

mattn avatar Jul 28 '20 01:07 mattn

@mattn

Closed by #743 ?

It's includes only bug fixes that is part of this.

I'm rebased, skip these commits and force pushed.

Milly avatar Jul 28 '20 05:07 Milly