Skip to content

msgpack.NULL is not nil! #927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
msiomkin opened this issue Sep 24, 2019 · 6 comments · Fixed by #3069
Closed

msgpack.NULL is not nil! #927

msiomkin opened this issue Sep 24, 2019 · 6 comments · Fixed by #3069
Labels
bug Something isn't working factual error Factual error in functionality description manual [location] Tarantool manual, no definite location need feedback [special status] On hold, awaiting feedback null See https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_null/

Comments

@msiomkin
Copy link
Contributor

https://www.tarantool.io/en/doc/2.2/book/box/data_model/#lua-vs-msgpack

This table maps msgpack.NULL to Lua nil. It's wrong. I think there should be cdata type.

@lenkis lenkis added 2.2 bug Something isn't working manual [location] Tarantool manual, no definite location labels Sep 27, 2019
@lenkis lenkis assigned Onvember and unassigned v-izmalkov Oct 21, 2019
@lenkis lenkis added the need feedback [special status] On hold, awaiting feedback label Oct 21, 2019
@lenkis
Copy link
Contributor

lenkis commented Oct 21, 2019

@msiomkin @kyukhin let's agree on this. what exactly do we want here?

@msiomkin
Copy link
Contributor Author

As I already said I think it should be cdata. @kyukhin right?

@lenkis lenkis assigned lenkis and unassigned Onvember Oct 28, 2019
@lenkis
Copy link
Contributor

lenkis commented Oct 29, 2019

@Totktonada
Copy link
Member

The table shows msgpack and lua types and also has a colon that shows examples of a Lua value. msgpack nil type has the only value: 0xc0.

Let's verify Lua -> msgpack mapping:

tarantool> msgpack.encode(nil):hex()
---
- c0
...

tarantool> msgpack.encode(box.NULL):hex()
---
- c0
...

Let's verify msgpack -> Lua mapping:

tarantool> msgpack.decode('\xc0')
---
- null
- 2
...

tarantool> type(msgpack.decode('\xc0'))
---
- cdata
...

So, yep, box.NULL (msgpack.NULL) is symmetric here, but I don't think that it would be wrong to give nil value as an example.

Anyway, Mike asks to add a type (cdata) to the column with values examples. I don't understood a motivation of this request. It at least would not be consistent: some examples would be types, some would be values.

@msiomkin Am I missed something?

@lenkis lenkis assigned veod32 and unassigned lenkis Dec 25, 2019
@msiomkin
Copy link
Contributor Author

some examples would be types, some would be values
@msiomkin Am I missed something?

@Totktonada "Lua type" column contains types, not values. "bin" and "array" MsgPack types map to "cdata". Why not also map msgpack.NULL to "cdata" if type(require("msgpack").NULL) equals to cdata and not nil?

@kyukhin
Copy link
Contributor

kyukhin commented May 29, 2020

I guess, @msiomkin proposes to document this:

tarantool> type(msgpack.decode('\xc0'))
---
- cdata
...

I.e. state it clearly, that box.NULL/msgpack.NULL have type cdata.

@patiencedaur patiencedaur added factual error Factual error in functionality description and removed 2.2 labels Feb 18, 2022
@patiencedaur patiencedaur added the null See https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_null/ label Mar 21, 2022
patiencedaur added a commit that referenced this issue Aug 5, 2022
p7nov pushed a commit that referenced this issue Aug 11, 2022
* Provide links to Lua and LuaJIT data types

Resolves #1318

* Replace wrong link to Lua 5.2 with correct to Lua 5.1

Resolves #1321

* Provide a more relevant link to Lua table manual

Resolves #1785

* Add msgpack.NULL to data types table

Resolves #927

* Add a sharded space example

Resolves #2474

* Clarify box.cfg.listen value type

Resolves #2855
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working factual error Factual error in functionality description manual [location] Tarantool manual, no definite location need feedback [special status] On hold, awaiting feedback null See https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_null/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants