[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] org.conman.iconv (was Re: Modules for iconv)
- From: Alexandre Erwin Ittner <alexandre@...>
- Date: Tue, 22 Apr 2014 21:46:58 -0300
Hello,
On Tue, Apr 22, 2014 at 3:56 AM, Sean Conner <sean@conman.org> wrote:
> It was thus said that the Great Dirk Laurie once stated:
>> Con:
>> 1. The arguments to iconv.new go TO,FROM whereas one's system
>> iconv goes FROM,TO.
>
> I can understand this ordering, as it mimics assignment. Heck, even I
> just recently thought my own iconv() went TO,FROM (I forgot I kept the
> system order).
Both lua-iconv "iconv.open" and the POSIX iconv_open() [1] uses TO,FROM
arguments; I felt keeping the same order was somewhat important.
On the other hand, POSIX iconv() [2] uses INBUF,OUTBUF intermixed with the
buffer sizes. This is a bit inconsistent with the previous one, but not
relevant as there is no way to keep this order in lua-iconv, as the Lua
version returns the converted string.
>> 2. It has one metatable only. So you need to say iconv.new to make
>> the converter and trans:iconv to invoke it.
>
> Actually, mine does this as well, only it's open(), not new().
lua-iconv uses both: open() and new() are aliases to the same function to
preserve, respectively, the name used by POSIX and the usual OOP semantics.
[1] http://pubs.opengroup.org/onlinepubs/009604499/functions/iconv_open.html
[2] http://pubs.opengroup.org/onlinepubs/009604499/functions/iconv.html
--
Alexandre Erwin Ittner - alexandre@ittner.com.br
OpenPGP pubkey 0x0041A1FB @ http://pgp.mit.edu