Hacker News new | ask | show | jobs
by adamb 5784 days ago
Our use of ' was inspired by lisp's.

Immutability such is an important part of Spin's messaging model that we wanted a consistent way to declare an immutable construction.

  # An immutable string (or symbol)
  'foo

  # An immutable list
  '[ 1, 'foo, '[] ]

  # An immutable map
  '{ foo: 1, y: 'two, z: '[ 'three ] }

Slightly more advanced...

  # Also an immutable string
  "foo with spaces" 

  # An immutable pair
  "bar" -> 2

  # Syntactic sugar for that same pair
  bar: 2 

  # Syntactic sugar for "baz" -> baz
  ~baz
1 comments

While we're talking about syntax, "\n" is an alternative to ",".

This helps multi-line expressions read more naturally.

  '{
    foo: 1
    baz: 'bar
    chunky: 'bacon
  }