expr.namein a value context, it is translated to the function application:
get_name exprTo illustrate this is really the case, consider the following example.
1: include "std"; 2: 3: // part 1 4: header """ 5: struct gauss 6: { 7: int x; 8: int y; 9: gauss() : x(0), y(0) {} 10: gauss(int _x, int _y) : x(_x), y(_y) {} 11: 12: }; 13: """; 14: 15: type gauss = "gauss"; 16: fun get_x: gauss -> int = "$1.x"; 17: fun get_y: gauss -> int = "$1.y"; 18: fun mkgauss: int * int -> gauss = "gauss($1,$2)"; 19: 20: val z = mkgauss(1,2); 21: print z.x; 22: print ", "; 23: print z.y; 24: endl; 25: 26: // part 2 27: struct X { 28: x : int; 29: } 30: val i = X(1); 31: print (get_x i); 32: endl; 33:
In part 2, the functions get_x and get_y are defined by defining a struct, and they're called directly, without the dot notation.
The dot notation is just syntactic sugar for calling a get function.
What is more, the struct definition is just syntactic sugar for defining an abstract type with some get functions (as well as a constructor).
What this means is that for an arbitrary C++ type, you can create an abstract binding, and define get methods which can be called using dot notation. Just name the methods 'get_' something.
It is also possible to access a Felix struct from C++, although we'll defer disucssion of the C++ representation of Felix data structures until later. [The C++ name of the struct type is not the same as the Felix name]