From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 5B9766EC5D; Wed, 7 Apr 2021 19:59:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5B9766EC5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617814788; bh=iJn0ziCObPev+Qk9CQ8in1FgKAieEbI8yK10wicqvdM=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=F1oEpCHa8tvpLn1QW4mh3HUgGsMt+ZOjqFBGjbrRgsmfDkftrPYP87kQpMHk+vKLz uNO6+saaMptm2m3SNcn45Tjkwl7teZWbRRoohviUwnMl5PN8tZRKaBt4N8l9z53MAv A/aFrzILQC72uVuj3fuH29rnFpDsRN40S48kLkeE= Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id DFDE26EC5D for ; Wed, 7 Apr 2021 19:59:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DFDE26EC5D Received: by mail-lf1-f42.google.com with SMTP id 12so29505698lfq.13 for ; Wed, 07 Apr 2021 09:59:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1CD2+cPU3Eit0Z9v5k9m4BbgLgCQdpVceg8Z9pucQOw=; b=BkVb2M2wXZb3sOL1CbdcFgvHZu/KNB8XgmqE2v+EnISnvChe48NNIxYb3+QH/sdpDB 4+asdGviqN6Hl9kpPZH1V3h2073VefMf/MXzuViErPrfRI0FGaOSb655fubuOyCfiV4O Pvo2elsAJ8VLYd+BL772+fXXC0CMmnPNLX3YuT2f34v4JNdjS1HjBYMJ8sRSpvdsHlRl /7yA1Ayp5rWvMKcuLxC23yb2COkXXWTR6ojcayDfxiK71otWH9YdFs6IG0I+HF2rlasZ a3DnfDTk0/fU8sx22cyTeVfjrK/88sMQboMrUznXxMca4AJhVtezvhoW3s/nLvkpQf/1 rF9g== X-Gm-Message-State: AOAM531szyCeIQcM9MjYZFV5Y3ETjm38AaPD8YSdbQbAZyRBgXwDa2YA cwh/aKE/QX1GERR3iP4dpi1XXCKdSnj41A== X-Google-Smtp-Source: ABdhPJzfUorsz2PNCCQ8MJrejhM8WawatLCx0ipdAgWH4Pk2JNkzwEqZSAFSrouNxvhiTPel5daQqg== X-Received: by 2002:a05:6512:21c2:: with SMTP id d2mr3015946lft.424.1617814786809; Wed, 07 Apr 2021 09:59:46 -0700 (PDT) Received: from grain.localdomain ([5.18.199.94]) by smtp.gmail.com with ESMTPSA id z10sm2542134lfe.114.2021.04.07.09.59.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 09:59:38 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 84F1B5601D6; Wed, 7 Apr 2021 19:59:35 +0300 (MSK) Date: Wed, 7 Apr 2021 19:59:35 +0300 To: Vladislav Shpilevoy Message-ID: References: <20210402123420.885834-1-gorcunov@gmail.com> <20210402123420.885834-7-gorcunov@gmail.com> <8d3a4d20-2887-7423-777f-2af808b65495@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d3a4d20-2887-7423-777f-2af808b65495@tarantool.org> User-Agent: Mutt/2.0.5 (2021-01-21) Subject: Re: [Tarantool-patches] [PATCH v20 6/7] box: implement box.lib module X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: tml Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Mon, Apr 05, 2021 at 06:04:41PM +0200, Vladislav Shpilevoy wrote: > > `require('box.lib').load(path) -> obj | error` > > 1. Implementation in C should allow not to call 'require()' at all. For > example, you don't call require('box.tuple') to use the tuples. The same > for lib. > > However I don't know what is the current rule for the new modules - force to > call require() or not. Please, ask Mons what should we do. In case we need to > force to call require() - I have no idea how to do that TBH, since the module > is in C really, not in Lua. It is loaded as a part of the executable file > anyway. > > 2. Why can't I use box.lib without calling box.cfg{}? I does not depend on it > anyhow. For example, box.tuple works fine, require() on .so files works fine, > even ffi.load() works fine without box.cfg{}. What is the problem with box.lib? Got rid of it and box.lib works without box.cfg{} call now, I'll send a new version. > > > +/** Handle __index request for a module object. */ > > +static int > > +lbox_module_index(struct lua_State *L) > > +{ > > + lua_getmetatable(L, 1); > > + lua_pushvalue(L, 2); > > + lua_rawget(L, -2); > > + if (!lua_isnil(L, -1)) > > + return 1; > > 6. What is happening here in these 5 lines? Actually this snippet comes from popen code where we have wrappers on lua level and test for metamethods. While it doesn't hurt it makes no much sense in current code, thanks! Will drop. And I agree on all comments, will address them and resend the series. Thanks for review, Vlad!