Closed davidzchen closed 10 years ago
Hybrid > Google > Python > Linux > LLVM
Hybrid > Google > LLVM > Python > Linux
(slight update - mistook Hybrid for mixed tabs + spaces, which it is not)
Hybrid > Google > LLVM > Lua > Linux > Python
Linux > Hybrid > LLVM > Google > Python
Linux > Hybrid > Google > LLVM > Python
Hybrid > Google > LLVM > Python > Linux
Linux > Hybrid > Google > LLVM > Python
@davidzchen I think you forgot to add the style of the cleanest codebase I've seen
Google > Hybrid > LLVM > Python > Linux
Linux -> LLVM -> Hybrid -> Python
LLVM -> Linux -> Hybrid
@tarruda - I have added an entry for the Lua style. I'm not sure if I have time to make a sample code Gist for it this morning since I could not find a documentation describing the style, and as a result, added a link to the online Lua sources. If you would like to make a Gist for it, I can can add a link to it.
Everyone else - if you prefer the Lua style, please feel free to update your votes.
Hybrid -> Python
Hybrid -> Google
LLVM > Lua > Google > Linux > Python > Hybrid
The formatting of Lua's lmathlib.c is different than luac.c.
I think all of the styles are acceptable, except the 1-space indent of luac.c.
Lua > Google > Hybrid > LLVM > Linux > Python
So either Lua or Google-style with C-style comments (/* */
).
I put Lua first but I'd actually like more newlines between logically separate parts of the code, like Google-style. I think I'm allowed to make this provision because I don't think it's usually part of the style conventions (tabs/spaces, braces-first, ...). An example:
Lua style without newlines (original)
int luaH_next (lua_State *L, Table *t, StkId key) {
int i = findindex(L, t, key); /* find original element */
for (i++; i < t->sizearray; i++) { /* try first array part */
if (!ttisnil(&t->array[i])) { /* a non-nil value? */
setnvalue(key, cast_num(i+1));
setobj2s(L, key+1, &t->array[i]);
return 1;
}
}
for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */
if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */
setobj2s(L, key, key2tval(gnode(t, i)));
setobj2s(L, key+1, gval(gnode(t, i)));
return 1;
}
}
return 0; /* no more elements */
}
Lua style with a few newlines for clarity:
int luaH_next (lua_State *L, Table *t, StkId key) {
int i = findindex(L, t, key); /* find original element */
for (i++; i < t->sizearray; i++) { /* try first array part */
if (!ttisnil(&t->array[i])) { /* a non-nil value? */
setnvalue(key, cast_num(i+1));
setobj2s(L, key+1, &t->array[i]);
return 1;
}
}
for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */
if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */
setobj2s(L, key, key2tval(gnode(t, i)));
setobj2s(L, key+1, gval(gnode(t, i)));
return 1;
}
}
return 0; /* no more elements */
}
I also dislike mixing comment styles a bit. In my own codebases I tend to use the default C /* */
style, which makes for aesthetically pleasing multiline comments that don't take extra space:
/* processes count items in array */
int func(void * arr, size_t count) {
if (arr == NULL || count == 0) {
return 0;
}
/* so, we're just going to return the count and act as if we've actually
* done all the items, let's implement this later */
return count;
}
Google > LLVM > Lua > Hybrid > Python > Linux
Like @justinmk said, I really like lmathlib.c's style, but I'm not sure if we're voting based on the default style in most of them (1 space indentation), or of lmathlib.c
(2 space indent). Other than that, all the options are good.
Hybrid > LLVM > Python > Google > Lua > Linux
Isn't there some free service that simplifies conducting these kind of polls? Ideally it would have a date limit and one we could easily see the results.
@tarruda: There are hundreds. Search for "online poll" or something.
Hybrid > Python > Google > LLVM > Linux
Linux > Hybrid > Google > LLVM > Python
@tarruda @simendsjo - Yes, there certainly are a lot of online poll services, but I think it would be ideal to have the vote data will be easily visible afterwards and in some way attached to this project. There are not that many rank poll services, but it would be possible to create a poll with a Google Doc form, but it may be a good idea to create an official neovim Google Group and use that account to create the Google Doc poll. We should go with that route in the future.
For this poll in particular, I suggested a deadline of 12 AM PST this Wednesday and will close the issue then. I think I'm going to write a Python script and scrape these comments and compute results and will post both the script and the results as Gists. Since many people have already responded, should we just continue here?
If somebody makes an online poll that's easy to use and where it's easy to login (perhaps with gh account), that'd be neat. Failing that, the scraping sounds like a good solution. The advantages are as mentioned: it's tied to github, where all code editing happens, and the voters all have a github account, probably/hopefully avoiding people spamming their favourite styles.
Having an automated tool for style checking would make things easier for everyone whatever the chosen coding style is
Hybrid > Google > LLVM > Lua > Python > Linux
Python > Lua > Linux > LLVM > Hybrid > Google
@x0l That could easily be done with a shell script
@tarruda I put together a form using google docs https://docs.google.com/forms/d/1cOQPSUFBV5DWZebROiJIX-BaL_YJhKK6luEGXHpaTtQ/viewform
Are we going to have a poll if we should use that poll now ? ;-)
Guys, let's not adopt the Apache ways too quickly. ;)
@gilligan, thanks for setting up the Google doc!
But for the sake of keeping this as simple as possible, I am more in favor of just keeping the poll here for the reasons discussed above. Let's use Google Doc for all future polls. @tarruda, is this fine with you?
@tarruda
Please rank each style below. Note that you are not allowed to pick the same rank (1=best to 5=worst) for two different coding styles
I have successfully managed to give all ranks 1. Though I am not sure whether my vote was actually recorded there, but it did not give any error message.
@ZyX-I There is no way to configure the poll like that. The disclaimer says 'not allowed to' as in 'you are not supposed to do this dummy' =) There is nothing that keeps you from writing a nonsense voting statement here in the comments. I was about to give an example but I guess I'd rather not because that might screw up the results of the python script..
Not ideal, but using the github issue tracker for a poll .. meh i dunno ;-) i should do something proper later but i'm on vacation in Turkey right now ... ;-}
@gilligan You can write nonsense in comment, but that only means my parser will ignore such votes. Will Google Docs ignore them? Please give an example. I added protection right after complaining about Google Docs problem.
Hybrid > LLVM > Python > Google > Lua > Linux
// Do not have a protection against duplicate votes. Will add it now.
Python > Lua > Linux > LLVM > Hybrid > Google
^ For testing protection against duplicate votes. This comment should be ignored.
LLVM > Hybrid > Python > Google > Lua > Linux
LLVM > Hybrid > Google > Lua > Linux > Python
Hybrid = LLVM = Google > Lua > Linux > Python
@Gaelan Your vote will be ignored. Voting system is not using =
.
Hybrid > LLVM > Lua > Python > Linux > Google
Hybrid > Google > Python > Linux > Lua > LLVM
Ugh, Hybrid, Python and Lua are mostly useless to me (as someone trying to write automatic conversion code to actually do the cleanup in one pass). It isn't that I mind the styles but the ambiguity is DOOM.
Can we please reduce this list to the very well documented ones (LLVM, Linux, Google C++) AND add links to the full documentation. So that whoever has to do the reformatting has a chance in HELL of being successful without endless future debates. Additionally, the big ones often are baked into style lint and other tooling.
Drafting off well written, complete, tested in the wild standards (and in the case of LLVM, even related ideals) makes a lot of sense for a project already going against the grain and swimming upstream.
@robertmeta I don't see the issue, most of it would be able to be converted with a script and regexp and the original post already has format examples
@ZyX-I Your vote parser adds any unsubmitted user rankings to the submitted ones in a way that gives them points. This isn't correct in that it's probably not what the submitters wanted and the actual winner could change when rerunning program without changing any of the input.
Google > LLVM > Python > Lua
Should it be set to start at 5, and go down for each specified, with 0 for each non specified? Or should non-specified formats be set to the average so we don't skew it for others who did include it?
On Feb 24, 2014, at 8:08 PM, "Michail Denchev" notifications@github.com wrote:
@ZyX-I Your vote parser adds any unsubmitted user rankings to the submitted ones in a way that gives them points. This isn't correct in that it's probably not what the submitters wanted and the actual winner could change when rerunning program without changing any of the input.
— Reply to this email directly or view it on GitHub.
Vote here (See results below)
As discussed in #66, we are holding a vote for the coding style that we will use as the basis as the coding convention for neovim. Let's keep this vote open until 11:59 PM PST on Wednesday, February 26.
How to vote
Please view the following Gists to view code samples in each of the coding styles. We are using ranked voting. To vote, rank the coding styles in order of preference and add a comment to this thread with your ranking. For example:
After the vote closes, we will tally up the rankings and choose a winner using Borda count. @ZyX-I's script will be used to scrape these comments and compute the results using the Borda count algorithm.
Results
Update: per @tarruda's request, I have added the Lua C style to the ballot. If you prefer the Lua style, please update your votes.
Notes