Skip to content

Cull keyword explosion

jckarter edited this page Nov 17, 2010 · 3 revisions

Motivation

Clay's syntax currently has 41 keywords! We should explore ways of simplifying the grammar without sacrificing readability or power of the language.

Proposed implementation

Discussion

Some keyword groups have similar semantics and could be folded into a single keyword:

  • alias and callbyname definitions both have call-by-name semantics
  • ref and lvalue respectively create and consume lvalues
  • default and else

Some fixed keyword syntax could be replaced with more general language features:

  • record, variant, enum, and instance all deal with types, and could be folded into a single type facility
  • inline and external could be indicated using generalized function attributes. perhaps static and callbyname too
  • and/or could use a generalized named infix operator feature
  • not could be a function

Other keywords could be replaced with symbols:

  • = might work as an as replacement in import statements: import bar = foo.bar; import foo.(bar = fooBar);
  • in in for statements