Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

Code Style and Conventions #317

Closed
izgzhen opened this issue Jun 3, 2017 · 5 comments
Closed

Code Style and Conventions #317

izgzhen opened this issue Jun 3, 2017 · 5 comments

Comments

@izgzhen
Copy link
Collaborator

izgzhen commented Jun 3, 2017

After several weeks of working with the code base, I noticed that @snowleopard tried to maintain some code style and convention, but up to now it is still more or less implicit.

I propose to make it explicit, by e.g. being written in wiki, so future maintenance will be easier to do.

@snowleopard
Copy link
Owner

I'm a bit sceptical about spending too much effort on this. Hadrian will eventually become a part of GHC and will then be subject to GHC's code style and conventions. Coming up with a wiki based on my code style idiosyncrasies sounds like a potential waste of time.

By the way, my code style was heavily influenced by this: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md, so we could just point contributors there as a good reference.

We do not have too many contributors now, and I am happy to occasionally do minor revisions for bringing the code into more coherent state in terms of style. For example, once your install PRs are in, I'll do some minor tweaking.

@izgzhen
Copy link
Collaborator Author

izgzhen commented Jun 5, 2017

I want to propose two (new) things on this:

  1. Try to attach the source of reference (somewhere in old *.mk) in the comments, esp. when there are some hardcoded magics
  2. Try to import with (...) rather then import everything. This makes it easier to find where some names come from (since we don't always have a decent IDE for Haskell hacking...)

I will try to maintain these as far as I can, but won't spend more time in revising existing code. Also, if there is something missing in my PR, it will be great if you can try to remind me as well @snowleopard :)

@snowleopard
Copy link
Owner

@izgzhen Fully agree regarding imports.

Regarding *.mk files: I think it would be more useful if we take the effort of writing more detailed comments, explaining all occurrences of black magic, instead of simply linking to the Make build system. These links tend to get out-of-date due to on-going development, and furthermore it is often very hard to make sense of Makefiles.

@izgzhen
Copy link
Collaborator Author

izgzhen commented Jun 5, 2017

writing more detailed comments, explaining all occurrences of black magic

Agreed.

Also, I will try to use a consistent reference style starting from now: ref: relative/path/from/ghc/toplevel:line-number, e.g. ref: mk/config.mk.in:241

@snowleopard
Copy link
Owner

@izgzhen Sounds good 👍

@izgzhen izgzhen closed this as completed May 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants