syntax styles

keywords and identifiers

there seem to be two extremes of keyword and identifier naming styles

  • symbolic: languages that prefer special characters, combinations of special characters and abbreviations. examples: apl, mathematical notation, haskell, perl
  • indicatory: languages that prefer words from the english language and alphanumeric characters. examples: coffeescript, scheme, ruby

different ways to mark nesting


example (vbscript)

if 3 = x then
  msgbox "test"
end if

for each a in list: msgbox a: next

benefit: quick to type


example (c)

if (3 == x) {

for (int i=1; i<array.size; i+=1) { printf("%u", array.data[index]); }

example (scheme)

(if (= 3 x)
  (display "test"))

(for-each display list)


example (coffeescript)

if 3 is x
  console.log "test"

list.forEach (a) -> console.log a

benefit: code written by different authors looks more similar, because they can not vary the placement of and whitespace around brackets a lot because few brackets are used. there is also only one main pattern to nest expressions, indent

operator placement style


+ 1 2 3 4


1 + 2 + 3 + 4


1 2 3 4 +