Thu Dec 15 08:40:33 EST 2011
C Struct's "." and "->" dereference.
Is it necessary to express such a thing, or is it probably better to
represent a struct as an array with a named index? Probably not
because the distinguishing property of a struct is that it's a
heterogenous product type.
There seems to be a structural gap between what I want in a vague
intuitive sense, and what I have in a concrete structural sense.
Current structure: function application and abstraction. These are
implemented by abstraction and assignment of structure types, so maybe
they should be implemented as such?
Transform a function operating on a variable (an in-place operation)
into something that is abstracted as a pure function that
"dereferences" the value, and a continuation function that "assigns"
That's nice and dandy, but doesn't eliminate the fact that at some
point real assignment needs to be implemented somewhere. So let's
just extend Get Set in Term to have composite types: [Type] instead of
Type, and see where this gets us.
No, that's the wrong track. It's important to distinguish:
- primitive operations accept and produce primitive data (Let)
- composite operations accept composite data (Lambda / App). they
do not produce anything as they are in CPS.
(Eexcept for invocation of Ret which does produce primitive data
but this is a special case.)
Another option is to pass the structs by value. However this doesn't
solve anything since it just replaces "->" dereference with "." but
still needs explicit support for dereference and
The short of it seems to be that there is no way around implementing
proper structure support. The question is how to encode it both in
Term and as proper (phantom) type signatures in Effect.