[Tarantool-patches] [PATCH] net.box: add __serialize and __tostring methods for future objects

Yaroslav Dynnikov yaroslav.dynnikov at tarantool.org
Fri Aug 13 20:41:28 MSK 2021


Hi! Thank you for the patch. Find my comments below.

Best regards
Yaroslav Dynnikov


On Fri, 13 Aug 2021 at 15:58, Vladimir Davydov <vdavydov at tarantool.org>
wrote:

> Example output (for more examples see the test output):
>
>   tarantool> f = c:eval('return 123', {}, {is_async = true})
>   ---
>   ...
>
>   tarantool> tostring(f)
>   ---
>   - 'net.box.request: 7'
>   ...
>

I think sync has no sense here. It's useless without other info (peer,
function).
Also, it complicates the tests and makes them less reliable.
IMHO simple 'net.box.request' is enough.


>   tarantool> f
>   ---
>   - method: eval
>     on_push_ctx: []
>     result: [123]
>     on_push: 'function: builtin#91'
>     sync: 7
>   ...
>

This is also weird:

tarantool> f
---
- on_push_ctx: []
  method: call
  sync: 4
  on_push: 'function: builtin#91'
...

tarantool> f.sync
---
- null
...

tarantool> f.method
---
- null
...

Why displaying inaccessible fields? You leave a developer no choice:

tarantool> debug.getmetatable(f).__serialize(f).method
---
- call
...

Of course, I miss that fields, but please, there should be another way to
access them.

Also, speaking of
https://github.com/tarantool/tarantool/commit/b996502b403c1698c4b0886de636faa0a63cfb70
,
which of them are you going to merge first? Whichever it is, I guess the
second one is destined to be refactored afterward.

Closes #6314
> ---
> https://github.com/tarantool/tarantool/issues/6314
>
> https://github.com/tarantool/tarantool/tree/vdavydov/netbox-future-serialize
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20210813/993a9201/attachment.htm>


More information about the Tarantool-patches mailing list