girving/duck — Issue #38: finalize static and delay syntax
Author: dylex
Created: 2011-11-14 06:30:57+00:00
State: open
Labels: syntax

The "delay" "keyword" only really needs to appear is types (and possibly patterns for lambda) and currently looks like function application, so is unambiguous there. In practice, there is little reason to use it in patterns, so limiting to types seems reasonable.

"static" however, appears in types similarly, but also needs to apply to let, case, and possibly lambdas. (Currently we really do treat it as a keyword in "let static", which is a hack.) One option is to allow it in patterns in general, and infer from them (`let static x = ...`, `case x of static _ ...`, `static x -> ...`). Another is to use special keywords. The fact that case has multiple patterns and looks strange argues for the latter. I would prefer a pre- or post-symbol, something like `_let` or `case#` or even `#->`. This scheme could also allow user functions like `if_` to be defined following a similar pattern.

Originally I wanted "delay" and "static" to be handled the same way, general enough even to support other macro-like "transforms", but I no longer think that's a good idea, as they're quite different. As a side note, backtick is the only character not (yet) parsed as anything (infix in haskell).