From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id F06EC469719 for ; Sat, 3 Oct 2020 06:24:29 +0300 (MSK) Date: Sat, 3 Oct 2020 06:24:43 +0300 From: Alexander Turenko Message-ID: <20201003032443.4jb6kevj6mv5jv4h@tkn_work_nb> References: <96922008cb146eaa04cb727472eda3e71f2e7bc8.1600955781.git.tsafin@tarantool.org> <185c95b5-edc6-10d0-50c0-ba7c086fc97a@tarantool.org> <20200929080304.GV18920@tarantool.org> <0ada01d698d7$15b21030$41163090$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <0ada01d698d7$15b21030$41163090$@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH 2.X 4/7] module api: luaL_register_module & luaL_register_type List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Timur Safin Cc: tarantool-patches@dev.tarantool.org, 'Vladislav Shpilevoy' On Fri, Oct 02, 2020 at 07:14:19PM +0300, Timur Safin wrote: > : From: Igor Munkin > : Subject: Re: [Tarantool-patches] [PATCH 2.X 4/7] module api: > : luaL_register_module & luaL_register_type > : > : Vlad, > : > : I glanced the patch and doubt these functions need to be exported by > : Tarantool. These functions neither wrap internals nor provide any > : performance benefits (e.g. reduce numbers of excess allocations). It > : would be nice to have such auxiliary interfaces in so called "modulekit" > : to make third party modules development easier, but I see no problem to > : borrow this code to merger/key_def as is for now. > > Ok, let me put it another way: > - we are agreed that this is necessary useful functionality which might > be part of some static library, as part of modulekit? No. As a module developer, why do you need to have functions in the metatable itself, not just in __index? Why do you need to hide a metatable with __metatable? Why do you need to register a module in some unobvious way? Just register it as foo.bar (require('foo.bar') will work) and do `return {bar = require('foo.bar')}` in foo.lua / foo.c (require('foo').bar will work). If you want to forbid require('foo.bar'), just do `package.loaded['foo.bar'] = nil` inside foo.lua / foo.c. (And it is necessary when you have something relatively complex: two level of nesting.) I don't want to discuss it on the level 'I guess it is useful'. You should understand use cases to advocate it.