Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org,
	Konstantin Osipov <kostja@tarantool.org>
Subject: Re: [PATCH v2 1/2] schema: move space_mt and index_mt definition out of space bless
Date: Sun, 1 Apr 2018 12:33:52 +0300	[thread overview]
Message-ID: <20180401093352.fyl2hq5r2itnahgr@esperanza> (raw)
In-Reply-To: <f913580788c46207b2ddd1de5c3d0706c3bd7cbc.1522333878.git.v.shpilevoy@tarantool.org>

For the record, as I said before

> I don't understand why anyone would do that. If one wants to
> implement some extra methods, they can always create a wrapper
> in Lua. Overwriting a metatable for this looks like a dirty hack.

so this is a purely technical review.

On Thu, Mar 29, 2018 at 05:31:44PM +0300, Vladislav Shpilevoy wrote:

> +function space_mt:len()
> +    check_space_arg(self, 'len')
> +    local pk = self.index[0]
> +    if pk == nil then
> +        return 0 -- empty space without indexes, return 0
>      end
> +end

> -    space_mt.len = function(space)
> -        check_space_arg(space, 'len')
> -        local pk = space.index[0]
> -        if pk == nil then
> -            return 0 -- empty space without indexes, return 0
> -        end
> -        return space.index[0]:len()
> -    end

This isn't what I meant when I wrote

> move index_mt and space_mt definitions from box.schema.space.bless
> without introducing any functional changes, then export them

I meant that in the first patch you should just move these functions to
the top-level, without doing ANY changes to them, otherwise the patch
will be rather difficult to review.

Anyway, I don't think the piece of syntax sugar you're trying to push
(passing the object to a class method implicitly) is really necessary.
We never do it in schema.lua, why do it for space_mt/index_mt now?
And it's definitely doesn't belong to this patch. Please remove.

> diff --git a/test/box-tap/schema_mt.test.lua b/test/box-tap/schema_mt.test.lua

The test should go to patch 2, the one that exports the metatables.

  reply	other threads:[~2018-04-01  9:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 13:07 [PATCH 0/2] schema: expose space_mt and index_mt on table Vladislav Shpilevoy
2018-03-23 13:07 ` [PATCH 1/2] schema: expose space_mt and index_mt on `box.schema` table Vladislav Shpilevoy
2018-03-23 13:07 ` [PATCH 2/2] schema: review fixes for box.schema.space/index metatables Vladislav Shpilevoy
2018-03-29 10:54 ` [PATCH 0/2] schema: expose space_mt and index_mt on table Vladimir Davydov
2018-03-29 14:31   ` [PATCH v2 0/2] schema: expose space_mt and index_mt on box.schema table Vladislav Shpilevoy
2018-03-29 14:31     ` [PATCH v2 1/2] schema: move space_mt and index_mt definition out of space bless Vladislav Shpilevoy
2018-04-01  9:33       ` Vladimir Davydov [this message]
2018-04-01 11:02         ` [PATCH 0/2] schema: expose space_mt and index_mt on box.schema table Vladislav Shpilevoy
2018-04-01 11:02           ` [PATCH 1/2] schema: move space_mt and index_mt definition out of space bless Vladislav Shpilevoy
2018-04-01 11:02           ` [PATCH 2/2] schema: expose space_mt and index_mt on `box.schema` table Vladislav Shpilevoy
2018-04-02 11:28             ` Vladimir Davydov
2018-04-03 16:50               ` [PATCH v2 0/3] schema: expose space_mt and index_mt on box.schema table Vladislav Shpilevoy
2018-04-03 16:50                 ` [PATCH v2 1/3] schema: move space_mt and index_mt definition out of space bless Vladislav Shpilevoy
2018-04-03 16:50                 ` [PATCH v2 2/3] schema: inherit vinyl/memtx_index_mt from base index mt Vladislav Shpilevoy
2018-04-03 16:50                 ` [PATCH v2 3/3] schema: expose space_mt and index_mt on box.schema table Vladislav Shpilevoy
2018-05-05 12:47                   ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-08 16:48                     ` Konstantin Osipov
2018-05-08 17:33                       ` Vladislav Shpilevoy
2018-03-29 14:31     ` [PATCH v2 2/2] schema: expose space_mt and index_mt on `box.schema` table Vladislav Shpilevoy
2018-04-01  9:37     ` [PATCH v2 0/2] schema: expose space_mt and index_mt on box.schema table Vladimir Davydov

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=20180401093352.fyl2hq5r2itnahgr@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [PATCH v2 1/2] schema: move space_mt and index_mt definition out of space bless' \
    /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