Environment. Closure

91 views
Skip to first unread message

pengk...@gmail.com

unread,
Mar 7, 2014, 6:03:37 PM3/7/14
to proglang-c...@googlegroups.com
 Since we have both environment and closure, where should we get the value of variable.

Aarne Ranta

unread,
Mar 10, 2014, 3:42:01 AM3/10/14
to proglang-c...@googlegroups.com
Recall that

  Closure = Expression + Environment

Closures are created when lambda abstracts are interpreted - this is actually the only rule in the interpreter that needs to create closures.

The  values of the variables in Environment are then copied to the closure. But they are still in the environment part of it.

The rule that needs to fetch the value of a variable is the evaluation rule for variable expressions:

   gamma |- x ! v    if  you get x:=v when looking up x in gamma

No closures involved here, just environments.

  Aarne.
Reply all
Reply to author
Forward
0 new messages