aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2021-10-30 06:59:59 -0700
committerGitHub <noreply@github.com>2021-10-30 06:59:59 -0700
commita141f6e9225fea065d8580b37510de2de168f9de (patch)
tree93ef10f8cbe0f7c6e95a08e9b0babb70da7874aa /runtime
parenteb6a1039c500dc901563b786b3cd06ff740ab152 (diff)
downloadrneovim-a141f6e9225fea065d8580b37510de2de168f9de.tar.gz
rneovim-a141f6e9225fea065d8580b37510de2de168f9de.tar.bz2
rneovim-a141f6e9225fea065d8580b37510de2de168f9de.zip
fix(vim.mpack): rename pack/unpack => encode/decode #16175
Problem: 1. "unpack" has an unrelated meaning in Lua: https://www.lua.org/manual/5.1/manual.html#pdf-unpack 2. We already have msgpackparse()/msgpackdump() and json_encode()/json_decode(), so introducing another name for the same thing is entropy. Solution: - Rename vim.mpack.pack/unpack => vim.mpack.encode/decode Caveat: This is incongruent with the `Unpacker` and `Packer` functions. - It's probably too invasive to rename those. - They also aren't part of our documented interface. - This commit is "reversible" in the sense that we can always revert it and add `vim.mpack.encode/decode` as _aliases_ to `vim.mpack.pack/unpack`, at any time in the future, if we want stricter fidelity with upstream libmpack. Meanwhile, `vim.mpack.encode/decode` is currently the total _documented_ interface of `vim.mpack`, so this change serves the purpose of consistent naming in the Nvim stdlib.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/lua.txt13
1 files changed, 6 insertions, 7 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 877c838602..1e058874bd 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -698,15 +698,14 @@ vim.diff({a}, {b}, {opts}) *vim.diff()*
------------------------------------------------------------------------------
VIM.MPACK *lua-mpack*
-The *vim.mpack* module provides packing and unpacking of lua objects to
-msgpack encoded strings. |vim.NIL| and |vim.empty_dict()| are supported.
+The *vim.mpack* module provides encoding and decoding of Lua objects to and
+from msgpack-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.
-vim.mpack.pack({obj}) *vim.mpack.pack*
- Packs a lua object {obj} and returns the msgpack representation as
- a string
+vim.mpack.encode({obj}) *vim.mpack.encode*
+ Encodes (or "packs") Lua object {obj} as msgpack in a Lua string.
-vim.mpack.unpack({str}) *vim.mpack.unpack*
- Unpacks the msgpack encoded {str} and returns a lua object
+vim.mpack.decode({str}) *vim.mpack.decode*
+ Decodes (or "unpacks") the msgpack-encoded {str} to a Lua object.
------------------------------------------------------------------------------
VIM *lua-builtin*