Felix can now handle all constant projections on the LHS of an assignment. The rules are:
An *lvalue* is either (a) a variable name (of a var) (b) a dereferenced pointer (c) the result of applying a primitive (C) function with "lvalue" attribute A valid LHS of an assignment is either (a) an lvalue (b) a projection applied to a valid LHS An projection is: (a) A field name of a struct or cstruct applied to it (b) a record field name applied to it (c) an integer literal applied to a tuple (d) an integer literal applied to an array The following are not yet supported properly but will be: (e) An expression of a compact linear type of the type of the index of an array applied to it (f) an integer expression applied to an array of unitsum index In case (f), the index expression will be bounds checked. In case (e) of course that cannot be necessary, In particular please note it is possible to assign into the middle of a compact linear type, even though such a field is not addressable. For example this currently works: ///////////////////////////////////////// begin println$ "Constant Double projection tuple/tuple (compact linear)"; var x = true,true,(false,case 0 of 3),true; println$ x; x . 2 . 1 = case 1 of 3; println$ x; end begin println$ "Constant Double projection tuple/array (compact linear)"; var x = true,true,(false,false),true; println$ x; x . 2 . 1 = true; println$ x; end begin println$ "Constant Double projection array/array (compact linear)"; var x = (true,true),(false,false); println$ x; x . 1 . 0 = true; println$ x; end ///////////////////////////////////////// I know this looks trivial, and would work easily in C or whatever. But there's a big difference. In Felix the variable "x" is all cases is just an int. You can think of projections of compact linear types a bit like C bitfields. However, unlike C these can be arranged in an arbitrary hierarchy, and, unlike C there's no restriction of such a field to a power of 2 values. Indeed the first example contains a trit (3 valued type). More in next message :) -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language