Child pages
  • Quotations

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A quotation is an expression, whose value is the MPS node written inside the quotation. Think about a quotation as a "node literal", a construction similar to numeric constants and string literals. That is, you write a literal if you statically know what value do you mean. So inside a quotation you don't write an expression, which evaluates to a node, you rather write the node itself. For instance, an expression 2 + 3 evaluates to 5, an expression < 2 + 3 > (angled braces being quotation braces) evaluates to a node PlusExpression with leftOperand being an IntegerConstant 32 and rightOperand being IntegerConstant 53.

The following two constructs again create the same AST, now the quotation approach yields clear benefits in code brevity:

...