Skip to content
ZacNugent edited this page Aug 2, 2017 · 2 revisions

Operators

Unary

  • Unary operators should have no whitespace between themselves and the argument.

Binary

  • Colons (a:b), powers (x^y and family), type declarations (a::T) and dots (a.b) should have no whitespace between operators and arguments.
  • All other operators should have surrounding white space, except:
    • When the arguments of a colon (:) expression are binary expressions with no surrounding brackets, no white space should be used. (i.e. a + b * c:d -> a+b*c:d or (a + b * c):d

Ternary: a ? b : c

  • Ternary conditional expressions should have (and in future versions must have) whitespace between arguments and operators.

Brackets: (), [], {}

  • There should be no whitespace between the opening bracket and first item.
  • There should be no whitespace between the final item and the closing bracket.
  • Unless a single item Tuple is being constructed, there should not be a comma before the closing bracket.

Commas

  • Commas should have no preceding whitespace and a single trailing space except:
    • When separating items in curly brackets, where there should be no surrounding white space i.e. {a,b}.

Line-length

  • Lines exceeding 92 characters should be split.
  • There should be no white space at the end of lines.
  • There should be one blank line at the end of a file.

Symbol Naming

  • Functions should be lowercase.
  • DataTypes and Modules should be capitalised (camel-case).

Indents

Clone this wiki locally