John Skaller - 2006-03-11

Logged In: YES

At the moment the only workaround is:

proc fopen: lvalue[int] * int = "$1 = fopen($2);";

var x:int <- fopen(c"Filename.txt");

The <- notation is just syntactic sugar of course.

The fact the wrapper generator flxcc doesn't know the
semantics of the C function is not surprising.

The issues here are deep. Even a function with no
side-effects need not be pure:

var x = 1;
fun f()=>x;
print (f()); endl;
x = 2;
print (f()); endl; //oops ...

and this has serious consequences for the optimiser because
it is aggressive about inlining function calls.

BTW: this issue is assigned to everyone -- tracker has no
way to say that so leaving it open at the moment.