public
Fork of nex3/arc
Description: Paul Graham's Brand New Lisp
Homepage: http://arclanguage.org
Clone URL: git://github.com/nick-b/arc.git
arc / CONVENTIONS
100644 133 lines (109 sloc) 5.671 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
This file details the conventions for code that's pushed to Anarki.
Because anyone can push code, it's important to keep the style as
clean and uniform as possible, so that the underlying code can be more
easily understood.
 
COMPATIBILITY
  Since Anarki isn't the official Arc codebase, it's important to keep
  it compatible with the official distribution. As such, please don't
  add any changes that make it incompatible with the latest official
  arcn release. This means that code that runs with arcn should always
  run with Anarki code.
 
  For the purposes of diffing and so forth, avoid reformatting
  code from arcn.tar without actually changing the code. This includes
  removing trailing whitespace, etc.
 
  Since it's also important to experiment with more radical ideas that
  will break compatibility, feel free to create branches
  ("git branch <branchname>" followed by "git checkout <branchname>")
  and commit your work there. To create a new branch in the remote
  repository, run "git push <branchname>:refs/heads/<branchname>".
  After the remote branch is created, just "git push" will work.
 
NAMING
  Global variables typically have an asterisk after their name
  (e.g. hooks*, templates*). All names are lowercase, with hyphen
  separators if neccessary.
 
DOCUMENTATION
  It's useful for functions and macros to include docstrings, although
  this isn't mandatory to encourage exploratory
  programming. Docstrings can be accessed via `help' and associated
  functions. Docstrings are just strings that are put as the first
  line of a function or macro definition and which describe how the
  function or macro is to be used. If a docstring takes up more than
  one line, further lines should be indented to match the beginning of
  the text of the original line. For example:
 
    (def identity (a)
      "Returns its argument.
       Potentially good for mapping or something."
      a)
 
  Comment formatting can be flexible, as comments are useful for all
  sorts of things that may have different stylistic
  requirements. However, for the sake of readability, please put at
  least one space between the semicolon and the beginning of the
  comment.
 
INDENTATION
  All indentation should be in spaces, as literal tab characters
  render inconsistently across editors.
 
  The general rule for indenting Arc are the same as for any other
  Lisp. In general, the first expression in a new line should be
  aligned with its leftmost sibling in the line above.
  For example, if we wanted to put a newline in `(and foo bar baz)'
  after `bar', we would write
 
    (and foo bar
         baz)
 
  If the newline were instead after `and', we would write
 
    (and
      foo bar baz)
 
  There are a few exceptions to this rule. These exceptions are
  usually made only for macros that take a certain number of arguments
  followed by a "body" of code that those arguments act on (e.g. def,
  fn, while, let). All arguments before the "body" of these macros are
  placed on the same line as the macro call, and the body itself is
  placed on the following lines, indented two spaces. For example:
 
    (def compose (f g)
      (fn args
        (f (apply g args))))
 
  Also, for macros that take a condition-code pair forms, (e.g. if,
  case), it's generally better to indent the code in the pair more
  than the condition. For example:
 
    (if
      (something-or-other foo bar)
        (do (this))
      (some-other-thing bar foo)
        (do (that)))
 
GIT
  The first line of a commit message should function like the
  "Subject:" header of an email. It's assumed to be the title of the
  commit; any further description should be put after the first
  line. This means that you should *not*:
    * Put part of a sentence on the first line and continue it in the
      rest of the patch.
    * Put a long, verbose description of the patch on the first line.
 
  When you try to git-push changes, you may get a message to the
  effect that the remote repository contains changes that aren't in
  your local repository. If you just git-pull and merge the changes,
  you get an unsightly commit saying "Merged with origin." To avoid
  this, use git-rebase instead. This will merge your local repo with
  the remote one in such a way that there's no monolithic merge stage
  that needs to be recorded.
 
  Using git-rebase
    Often when someone makes a bunch of local commits, they aren't as
    nice as they could be when the time comes to push them to the
    server. There may be one commit that fixes a bug in another, or
    there might be a commit recording a merge with the remote
    repo. git-rebase is a tool to clean these up.
 
    Before you push a bunch of changes to the remote repo, you can run
    "git rebase -i origin/master". This will open up a text editor
    with a list of local commits that you can manipulate. You can then
    re-order commits, "squash" them together (making two commits into
    one), or get rid of them entirely (this is rarely a good idea) by
    moving around the items in the list and editing the command to the
    left of each commit. When you're done, close the text editor and
    Git will run all the changes.
 
    Note that empty commits, like the "Merge branch" messages, won't
    show up in the "git rebase -i" list. If you just want to get rid
    of these, it's usually sufficient to just call "git rebase -i
    origin/master" and then close the text editor immediately.
 
    For more information, run "git help rebase".
 
NEWLINES
  All text should use Unix-style newlines. Be especially sure not to
  convert existing files into Windows-style newlines, as that screws
  up the Git history.