ghc - Continuation versus call stack in Haskell -
how haskell (ghc) runtime know code should executed next after evaluation of thunk?
on conceptual level, how different call stack in other programming languages (other storing closed variables on heap , having tail recursion)?
ghc (or rather, ghc rts) has normal call stack, things.
what's different contents of stack. doesn't match might expect.
suppose function foo
calls function bar
calls function baz
. might expecting call stack like
foo bar baz
at point. actually, when foo
calls bar
, "call" create thunk , return instantly. bar
doesn't appear on stack @ point. when foo
returns data caller, , caller decides it, @ point bar
may appear on call stack, though foo
seen.
in short, order of stuff on call stack unrelated calls who. it's determined looks @ what.
Comments
Post a Comment