(const pat init)
  pat: a pattern
  init: any form
C

Defines one or more associated constants.

(const a b c d) is equivalent to (const a b) followed by (const c d).

Constants don't take up any space in the object; they are stored in the class instead. Their initializer forms are evaluated while the class or mixin form is being evaluated. Those initializers may refer to constants defined earlier in the same state, or constants defined in parent states, using the @ syntax.

Constants participate in name shadowing, just like fields. Constants can shadow fields, and vice versa.

When a constant is defined at the toplevel of a class, it can be read by indexing the class itself using [].

(defclass Example
  (const a 100)
  (const b (* @a 5)))

(let ob (Example))

(prn [ob 'b]) ; prints 500
(prn [ob 'Main:b]) ; prints 500
(prn [Example 'b]) ; prints 500
(prn [Example 'Main:b]) ; prints 500
field
meth