Ouch .. something I didn't think of: with a compact representation
of types like 3 * 2 in a single integer .. the components aren't addressable.
And so not assignable in principle. Same deal as bitfields in C.

I can fudge it in some cases with a read/modify/write.

the case that actual fails in my tests is fixable:

var i : 3 = case 1 of 3;
var j : 3 = case 2 of 3;
var ij : 3 * 3 = i,j;

At present Felix tries to assign the components of ij separately like:

ij.0 = i; 
ij.1 = j;

which fails. There's a related issue: tuple coercions like:

var xyz = i,j,"Hello";
var xy = xyz :>>  3 * 3; // chop of trailing string

can work but require repacking the two leading components
into a single integer. But the corresponding pointer coercion
cannot work because the representation changes when a tuple
is a linear type.

This is .. well its a mess :) Originally i only proposed to change array
indexing.

Note that assignment can be fixed if you consider only assigning
to whole variables but use "functional update" on the RHS. 
This allows the compiler to optimise to separate component updates
when possible but otherwise it just rebuilds the new tuple and
assigns the whole thing.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to