Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 620A1431FC0 for ; Wed, 18 Jul 2012 13:17:53 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y6Exg21L3DP9 for ; Wed, 18 Jul 2012 13:17:53 -0700 (PDT) Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU [18.7.68.37]) by olra.theworths.org (Postfix) with ESMTP id B4C8F431FAE for ; Wed, 18 Jul 2012 13:17:52 -0700 (PDT) X-AuditID: 12074425-b7f9b6d0000008c4-77-500719ef5ce6 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP id E7.55.02244.FE917005; Wed, 18 Jul 2012 16:17:52 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q6IKHoQc019065; Wed, 18 Jul 2012 16:17:51 -0400 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6IKHmOe022111 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Wed, 18 Jul 2012 16:17:50 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1Sragu-00019T-5r; Wed, 18 Jul 2012 16:17:48 -0400 Date: Wed, 18 Jul 2012 16:17:48 -0400 From: Austin Clements To: Adrien Bustany Subject: Re: [PATCH 1/7] go: Use iota in enum bindings Message-ID: <20120718201748.GS31670@mit.edu> References: <1342636475-16057-1-git-send-email-adrien@bustany.org> <1342636475-16057-2-git-send-email-adrien@bustany.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1342636475-16057-2-git-send-email-adrien@bustany.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42IR4hTV1v0gyR5gMP0bk8X6O2vZLK7fnMns wOTx8cA9Jo9nq24xBzBFcdmkpOZklqUW6dslcGV8uHuJveAcT8Wv/c1MDYzdXF2MnBwSAiYS 11/uZYKwxSQu3FvP1sXIxSEksI9RYk/LFFaQhJDABkaJ3uYIiMRJJokp5/exQjhLGCUeNn4B a2cRUJXY+OokmM0moCGxbf9yRhBbREBdYkdnO5jNLCAt8e13M1ANB4ewgJnE1+u1IGFeAR2J v3c2Qy2rltj0dg0rRFxQ4uTMJywQrVoSN/69BGsFGbP8HwdImFPAWeLHzl3sILaogIrElJPb 2CYwCs1C0j0LSfcshO4FjMyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdC30cjNL9FJTSjcxgoKa 3UV1B+OEQ0qHGAU4GJV4eB/sYg0QYk0sK67MPcQoycGkJMr7SYg9QIgvKT+lMiOxOCO+qDQn tfgQowQHs5II7wNBoBxvSmJlVWpRPkxKmoNFSZz3RspNfyGB9MSS1OzU1ILUIpisDAeHkgSv NDB6hQSLUtNTK9Iyc0oQ0kwcnCDDeYCG84LU8BYXJOYWZ6ZD5E8x6nJce3jrFqMQS15+XqqU OO8bCaAiAZCijNI8uDmwZPSKURzoLWFePpBRPMBEBjfpFdASJqAl3MVsIEtKEhFSUg2MRbM2 SsWwKXBbuDYefXaJ3/tU+ox5/ZuCg+40hBx/WvA++rgU2+W1t/s+vS4I/iFiN+E0810/0U83 r21L1j20KJPnftBbqycr1d5kBzZf3OZQq36j9tCcHzYVQp8dbmsx3eIt49l7apO0fqXZ43zL 06J7Hr2Wnx0fs6nt5W0xD/E+hmu3an+sU2Ipzkg01GIuKk4EAAaF7lEhAwAA Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 20:17:53 -0000 Hah. I guess nobody has tried to modify a notmuch database using the Go bindings. Could this instead assign the constants to C.NOTMUCH_DATABASE_MODE_READ_ONLY, etc, rather than duplicating their values? It would be nice to do that for the Status values as well (which are correctly using iota, at least). Quoth Adrien Bustany on Jul 18 at 9:34 pm: > Using iota is the correct way to get the values in the enum increment > automatically. The old code would just set all the enum values to 0. > --- > bindings/go/src/notmuch/notmuch.go | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/bindings/go/src/notmuch/notmuch.go b/bindings/go/src/notmuch/notmuch.go > index 00bd53a..ecd7418 100644 > --- a/bindings/go/src/notmuch/notmuch.go > +++ b/bindings/go/src/notmuch/notmuch.go > @@ -86,7 +86,7 @@ type Filenames struct { > type DatabaseMode C.notmuch_database_mode_t > > const ( > - DATABASE_MODE_READ_ONLY DatabaseMode = 0 > + DATABASE_MODE_READ_ONLY DatabaseMode = iota > DATABASE_MODE_READ_WRITE > ) > > @@ -386,7 +386,7 @@ func (self *Database) CreateQuery(query string) *Query { > type Sort C.notmuch_sort_t > > const ( > - SORT_OLDEST_FIRST Sort = 0 > + SORT_OLDEST_FIRST Sort = iota > SORT_NEWEST_FIRST > SORT_MESSAGE_ID > SORT_UNSORTED > @@ -774,7 +774,7 @@ func (self *Message) GetFileName() string { > type Flag C.notmuch_message_flag_t > > const ( > - MESSAGE_FLAG_MATCH Flag = 0 > + MESSAGE_FLAG_MATCH Flag = iota > ) > > /* Get a value of a flag for the email corresponding to 'message'. */