Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Yaroslav Dynnikov <yaroslav.dynnikov@tarantool.org>
Cc: tml <tarantool-patches@dev.tarantool.org>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH] net.box: add __serialize and __tostring methods for future objects
Date: Tue, 17 Aug 2021 10:58:56 +0300	[thread overview]
Message-ID: <20210817075856.xkelwdonp5kmdofs@esperanza> (raw)
In-Reply-To: <CAK0MaD0AZd6z08sPf2rr55pp4KtTr2cyDiL2nk1YJn09fM+vbA@mail.gmail.com>

On Fri, Aug 13, 2021 at 08:41:28PM +0300, Yaroslav Dynnikov wrote:
> On Fri, 13 Aug 2021 at 15:58, Vladimir Davydov <vdavydov@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.

Agree.

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

Reworked the patch. Now __serialize returns user-defined fields if there
are any. If there's no fields, it falls back on __tostring. Will send v2
in reply to this email. Please take a look.

  reply	other threads:[~2021-08-17  7:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 12:58 Vladimir Davydov via Tarantool-patches
2021-08-13 17:41 ` Yaroslav Dynnikov via Tarantool-patches
2021-08-17  7:58   ` Vladimir Davydov via Tarantool-patches [this message]
2021-08-17  8:00     ` [Tarantool-patches] [PATCH v2] " Vladimir Davydov via Tarantool-patches
2021-08-24 22:39       ` Vladislav Shpilevoy via Tarantool-patches
2021-08-25 13:35         ` Vladimir Davydov via Tarantool-patches
2021-08-25 20:08           ` Vladislav Shpilevoy via Tarantool-patches
2021-08-26 14:56           ` Yaroslav Dynnikov via Tarantool-patches
2021-08-26 15:05             ` Vladimir Davydov via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210817075856.xkelwdonp5kmdofs@esperanza \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --cc=vdavydov@tarantool.org \
    --cc=yaroslav.dynnikov@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] net.box: add __serialize and __tostring methods for future objects' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox