[<<][staapl-blog][>>][..]
Sun Jul 6 15:18:49 CEST 2008

Projected Semantics

 Q: What?

All arithmetic expressions in Coma are evaluated as soon as possible.
However, the partial evaluation of arithmetic operators does _not_ use
the target's limited word length representation, so not all operations
yield the same result if they are evaluated at compile time.  This is
in the same spirit of macro assembler expression languages.

 Q: Why is it useful?

It's a sharp knife that can be a great tool if you know how to handle
it.  Essentially, it allows Forth's staging annotations - the words [
and ] - to be dropped in Coma code.

 Q: Doesn't it lead to a mess?

Yes, if you don't know when an expression is evaluated.  This is well
specified however.  The problem is in realizing that the operations of
expression evaluation and value+operation projection _don't commute_
for all operations.  They do commute for addition and subtraction
(i.e. for PIC18 equivalence modulo 2^8), but involving multiplication
and division (and bit shifts) breaks the morphism.

 Q: Can I get some more hand-holding?

I don't know how to appropriately add constraints to this to eliminate
common mistakes.



[Reply][About]
[<<][staapl-blog][>>][..]