-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TODO] guidelines for contributing PR's, code style guide, guidelines for issues, forum #8271
Conversation
0256514
to
28cc3f6
Compare
contributing.md
Outdated
|
||
rationale: | ||
* proc are more hygienic | ||
* macros don't work well with UFCS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They work just fine with "UFCS" (which is called "method invocation syntax" in Nim. Why? Because there is nothing uniform in special casing the first argument). What doesn't work fine with UFCS is untyped
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
contributing.md
Outdated
rationale: | ||
* proc are more hygienic | ||
* macros don't work well with UFCS | ||
* templates and macros don't appear in stackrace, making debugging harder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stacktraces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
contributing.md
Outdated
as general rule of thumb, a proc should be preferred over a template, and a template should be preferred over a macro. | ||
|
||
rationale: | ||
* proc are more hygienic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "procedures" instead of "proc" here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
This document should link to NEP1 instead of repeating it partially (I'm referring to the proc vs. template vs. macro thing here). Also, please see this: https://help.github.com/articles/setting-guidelines-for-repository-contributors/. There are some really good examples there that we should simply copy. I prefer the Open Government one as it's short. The idea for this document is to let people know about contributing, not about the code style or what the Nim forum is good for (we have documents for that already). This document needs to be short and to the point. |
@dom96 thanks for mentioning NEP1 (https://nim-lang.org/docs/nep1.html), I'll fix that PR to avoid repeating what's in there (also referring to it in contributing.md would increase visibility of NEP1)
Not sure where's the best place to put this but what I wanted was a central easy to find document/folder that contains (or points to other docs) with best practices (prefer X over Y, with a rationale for that, sometimes pros/cons) That document should be comprehensive as opposed to minimal to help users in common situations (both for Nim repo but should be relevant for 3rd party code); example:
It should be continuously updated as a single authoritative source of best practice ; eg having a choose X over Y in there is often more practical than deprecating Y (to avoid breaking code that depends on Y) Maybe contributing.md is not the right place for that? |
* try to use `runnableExamples:` block to make generated docs more illustrative and for testing purposes | ||
|
||
### unit tests | ||
* more extensive testing (eg that would be overkill for docs) can be done in `when isMainModule` blocks right below the proc: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not what we do now (currently all additional tests go into a single isMainModule
block at the bottom of the file), and IMO it shouldn't change. Typically when you're working on a module you're interested in either the implementation or the tests, not both at the same time. Having to read code that is a 50/50 split of tests and implementation is just painful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the main thing that should be mentioned in this section is testament and how to use it
|
||
## git | ||
### use `git rebase` instead of `git merge` | ||
In command line (for person doing PR): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't care one way or the other, but is this currently one of the guidelines used when contributing? I feel this PR should document the guidelines and best practices that are in place, not invent new ones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be more clear: I think that imposing all this git trickery will only discourage useful PRs. I think I have seen many PRs that were not rebased or squashed, but were accepted anyway
### prefer `any` or a explicit or generic type over `untyped` for `template` and `macro` parameters when possible | ||
rationale: early type checking makes it easier to debug errors | ||
|
||
### use `void` instead of `typed` for `template` and `macro` output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this suggestion is very clear. void
means - well, no return type. As such, it can only be used when the template does not return anything, or so I think. If I have, say, template foo(): untyped = 5
, I should change that untyped
into int
, not void
We already have: https://github.com/nim-lang/Nim/blob/devel/doc/contributing.rst Please add your ideas to this document instead. And yes, we use |
I don't think it is the right place. In fact, NEP1 seems like a fine place for this too. It explains all code style, this could include |
This is all well and good, but GitHub shows a link to a |
That bites with your RFC of removing top level files though. And indeed, it feels messy, so I agree with your RFC. |
You can store these kinds of files in a |
So I guess we have to rename our |
c951290
to
b370902
Compare
proc myStringify(a: int) : string = | ||
## Stringifies ``a``. | ||
## | ||
## On Windows, follows this [spec](https://en.wikipedia.org/wiki/Hidden_file_and_hidden_directory). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this mixing of .rst syntax (double backticks) and .md syntax (link)? Will this work as intended?
doAssert foo(0) == "0" | ||
result = $(a) | ||
``` | ||
* we use double backticks (bolds text in RST) as ooposed to single backticks (italicizes it) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo (ooposed)
Well we have a contributing guide already, apparently you haven't read it (I'm not blaming you at all!). It's fair to assume this one won't be read either. Contributing should be simple/easy/fast, long documents how to do it are more counter productive than helpful. |
Yep, this is far too long. As I've mentioned previously, if we really want this then let's just adopt one of these (Open Government is my favourite): https://help.github.com/articles/setting-guidelines-for-repository-contributors/ |
this doc is intended to grow over time to make it easier to keep track of best practices
runnableExamples