Yes, something like this has been done, although not the extension to
environments. See "First-class labels for extensible rows":
http://lambda-the-ultimate.org/node/174
IIRC, the approach therein does essentially what you describe: defines a
"row" and "label" kinds, and defines operators for record selection,
extension and contraction given rows and labels. So if your compilation
target support this, the environment could be viewed as a record
threaded through the program and extended for every local binding.
Unifying this concept with numeric indices seems to be trickier, since
the label set is now inductively defined, but the above approach
trivially supports named function arguments.
First-class labels compiles down to efficient dictionary-passing code.
Your other message also mentioned hesitation over the complexity of
efficient pattern matching compilation, but this paper also provides a
solution whereby pattern matching compiles down to the same
dictionary-passing code, where the dictionary index is simply the sum's
tag. This conceptually unifies pattern matching and method dispatch
quite nicely.
Sandro
On 27/12/2014 8:38 AM, Jonathan S. Shapiro wrote:
Suppose, for just a moment, that we admit a new Kind into BitC:
literal identifiers.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev