Felix has a forward composition operator: (f \circ g) x = f (g x)
There's no reverse composition operator, because I can't think of a suitable symbol. Operator dot (.) was used before and leads to a nice notation: x . (f . g) = (x . f) . g but it doesn't work because f. g means application of g to f. Although this usually works for concrete types, overloading can get it confused, and polymorphism really screws it up. I could use x . (f \cdot g) [\cdot is a fat centred dot in TeX] although the precedence isn't clear! Consider also: f \circ g \cdot h . x to see: where do the parens go? Anyhow, i have one more thing to do in the wrapping stuff, actually lambda lifting: f \circ g --> fun x => f (g x) Now the projections work, Felix can finally express properly what C++ can't: struct Inner { int x; } struct Outer { Inner y; } var OI = y of (Outer); var Ix = x of (Inner); var Ox = OI \circ Ix; This is the composition of the projection from Outer to y, and Inner to x, giving a projection from Outer to x. In C++, field projections are called pointers to members. they cannot be composed, showing the type system is incomplete. In Felix, projections are just functions, so they can be composed if the domain of the second applied is the codomain of the first. No special operation is required, it's ordinary function composition. What's more, since projections work with pointers to a struct (or any product type). Pointer projections: var I : Inner; (&I) . x <- 42; eliminate the need for idiot lvalue rules. So we have a much nicer type system which means composing things works much better. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language