I'm finally adding a new operator:
//////////////////////////////////
#import <flx.flxh>
union XX = | Dummy of int;
var pp = Dummy 22;
print$ caseno pp; endl;
var x = 1;
var px = new x;
print x; endl;
print (*px); endl;
//////////////////////////////////
This code compiles and gives the right result,
then segfaults for an unknown reason.
The XX/Dummy crud is there to tell the RTTI generator
to make 'int' a heapable type: this is a hack,
somehow union constructor elaborations like:
Dummy 22
are detected and it knows this requires a pointer
to a heap copy of the argument, but it doesn't
recognize
new 22
at the moment.
There will be a series of problems with this feature.
It also has to be recognized as a generator, since
creating a heap object has definite side effects,
which the returned pointer depends on.
A complete red herring but generators would allow
x = y++;
if ++ were a generator function instead of a procedure.
This basically gives us back C style expressions with
side effects, since the generator attribute now forces
the unravelling of the side effect producing expressions.
If someone want to try the above program and figure out
why the biatch is segfaulting that would be cool,
I have no idea.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language