From: Austin Clements <amdragon@MIT.EDU>
To: Adrien Bustany <adrien@bustany.org>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH 1/7] go: Use iota in enum bindings
Date: Wed, 18 Jul 2012 16:17:48 -0400 [thread overview]
Message-ID: <20120718201748.GS31670@mit.edu> (raw)
In-Reply-To: <1342636475-16057-2-git-send-email-adrien@bustany.org>
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'. */
next prev parent reply other threads:[~2012-07-18 20:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-18 18:34 [PATCH 0/7] Various fixes for the Go bindings Adrien Bustany
2012-07-18 18:34 ` [PATCH 1/7] go: Use iota in enum bindings Adrien Bustany
2012-07-18 20:17 ` Austin Clements [this message]
2012-07-18 20:36 ` Sebastien Binet
2012-07-18 18:34 ` [PATCH 2/7] go: Add missing MESSAGE_FLAG_EXCLUDED in Flag enum Adrien Bustany
2012-07-18 18:34 ` [PATCH 3/7] go: Allow notmuch objects to be garbage collected Adrien Bustany
2012-07-18 20:40 ` Austin Clements
2012-07-19 18:25 ` Adrien Bustany
2012-07-20 3:23 ` Austin Clements
2012-07-23 22:03 ` Adrien Bustany
2012-08-04 19:28 ` Austin Clements
2012-10-19 3:55 ` Ethan Glasser-Camp
2012-10-25 18:41 ` Adrien Bustany
2012-07-18 18:34 ` [PATCH 4/7] go: Make Destroy functions safe to call several times Adrien Bustany
2012-07-18 18:34 ` [PATCH 5/7] go: Partially bind notmuch_database_upgrade Adrien Bustany
2012-07-18 20:41 ` Austin Clements
2012-07-18 18:34 ` [PATCH 6/7] go: Bind notmuch_database_find_message_by_filename Adrien Bustany
2012-07-18 18:34 ` [PATCH 7/7] go: Bind notmuch_thread_t functions Adrien Bustany
2012-07-18 20:50 ` Austin Clements
2012-07-18 20:51 ` [PATCH 0/7] Various fixes for the Go bindings Austin Clements
2012-07-19 18:29 ` Adrien Bustany
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120718201748.GS31670@mit.edu \
--to=amdragon@mit.edu \
--cc=adrien@bustany.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).