Skip to content

Commit

Permalink
Add TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
tekknolagi committed Jan 5, 2024
1 parent 7d9bc09 commit d3f1e63
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scrapscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,8 @@ def eval_exp(env: Env, exp: Object) -> Object:
# Y combinator or similar, so we bind functions (and only
# functions) using a letrec-like strategy. We augment their
# captured environment with a binding to themselves.
# TODO(max): Add "closure improve", which filters bindings to those
# used by the underlying function.
assert isinstance(value.env, dict)
value.env[exp.name.name] = value
return EnvObject({**env, exp.name.name: value})
Expand All @@ -1182,8 +1184,12 @@ def eval_exp(env: Env, exp: Object) -> Object:
if isinstance(exp, Function):
if not isinstance(exp.arg, Var):
raise RuntimeError(f"expected variable in function definition {exp.arg}")
# TODO(max): Add "closure improve", which filters bindings to those
# used by the underlying function.
return Closure(env, exp)
if isinstance(exp, MatchFunction):
# TODO(max): Add "closure improve", which filters bindings to those
# used by the underlying function.
return Closure(env, exp)
if isinstance(exp, Apply):
if isinstance(exp.func, Var) and exp.func.name == "$$quote":
Expand Down

0 comments on commit d3f1e63

Please sign in to comment.