From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id EDF7523F1D for ; Fri, 4 May 2018 20:18:06 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kZpXEYutb0lc for ; Fri, 4 May 2018 20:18:06 -0400 (EDT) Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [94.100.177.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 54FD523F19 for ; Fri, 4 May 2018 20:18:05 -0400 (EDT) Date: Sat, 5 May 2018 03:18:15 +0300 From: Alexander Turenko Subject: [tarantool-patches] Re: [PATCH v2 5/5] lua: introduce utf8 built-in globaly visible module Message-ID: <20180505001815.2qaim6cgkya4pnx6@tkn_work_nb> References: <562a24d9c42df6701e85d50b06a47d57e6d884bf.1524955403.git.v.shpilevoy@tarantool.org> <20180504223322.y7i5ymo46hcd7usu@tkn_work_nb> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: Vladislav Shpilevoy Cc: tarantool-patches@freelists.org Vlad, Thanks for the fixes. You are rock! I want to clarify two things, please see below. WBR, Alexander Turenko. On Sat, May 05, 2018 at 02:32:27AM +0300, Vladislav Shpilevoy wrote: > Hello. Thanks for review. > > On 05/05/2018 01:33, Alexander Turenko wrote: > > Vlad, > > > > Are you try to run tests from utf8.lua from [1]? > > > > [1]: https://www.lua.org/tests/lua-5.3.4-tests.tar.gz > > Are you think such testing would be redundant? I don't insist, just want to know explicit position. > > > + > > > +/** > > > + * Calculate length of a UTF8 string. Length here is symbol count. > > > + * Works like utf8.len in Lua 5.3. > > > + * @param String to get length. > > > + * @param Start byte offset. Must point to the start of symbol. On > > > + * invalid symbol an error is returned. Can be negative. > > > > Can be 1 <= |start| <= #str + 1, right? Is it worth to document? Such > > offset equilibristics is not very intuitive (at least for me). > > No, start can be any, as well as end. > It does not look like so: tarantool> print(utf8.len('abc', 0)) nil position is out of string tarantool> print(utf8.len('abc', 5)) nil position is out of string tarantool> print(utf8.len('abc', 1, 4)) nil position is out of string That matches lua 5.3 behaviour, but contradicts with your words above. So the question is about proper doxygen-style comment. > > > > > + * @param End byte offset, can be negative. Can point to the > > > + * middle of symbol. > > > > We need to clarify that a symbol under the end offset is subject to > > include into the resulting count (inclusive range). > > > > I would also explicitly stated that -1 is the end byte. > > > > Worth to document allowed range (0 <= |end| <= #str, right?)? >