A mapping in C!! is the definition of a transformation between two types or two contracts (and, by extension, define mappings between two types that honor the contracts in the mapping). Boy, that’s a mouthful. Oh, and I’m not done figuring out the syntax for this – so beware, it’s going to be very rough around the edges.
So let’s say you have Type A (or Contract A) and Type B (or Contract B).
You can define a mapping between them like this:
struct A
{
int a;
string firstname;
string lastname;
string middlename;
}
struct B
{
float value;
string firstname;
string middlename;
string lastname;
string playaname;
}
loose * mapping A ==> B
{
value = (float)in.a;
}
loose * mapping B ==> A // this is the reverse mapping
{
a = (int)in.value;
}
(more...)