Ok, I implemented this.  The default kind for procedures and
generators is now "var".

However I'm still a bit confused:

fun cond (c:bool) (t:int) (var f:int)  => if c then t else f;
fun div (var x:int, var y:int) =>
  cond (y==0) (-1) (x/y)
;

proc check()
{
  var z = 0;
  var o = 1;
  println$ o,z;
  println$ div (o,z);
}

check;

The above code works (returns -1). It should crash.
It seems like inlining is re-instating the lazy evaluation :)

Even "noinline" on the cond doesn't fix it.
However this crashes as expected:

noinline fun cond (c:bool, t:int, var f:int)  => if c then t else f;
fun div (var x:int, var y:int) =>
  cond$ y==0, (-1), (x/y)
;

So what's happening I believe is that the uncurrying algorithm
is losing some information. The original cond will be uncurried
to the second one roughly, however either the "noinline"
is lost, or the "var" is lost, or both.

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




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to