Skip to content

Globals/Locals: Mini-LISP C implementation - a-list behavior #441

@OfirMarkowitz1

Description

@OfirMarkowitz1

@DorYeheskel @yossigil
Though I can't run the C implementation, I picked up a few possible errors regarding the binding process of actuals to formals, when calling a lambda expression.

  1. The restoring of the a-list after executing the lambda to it's state before execution isn't done, leading me to believe that when there's intersecting formals between a caller and a callee lambdas, after the callee's execution ended, the binding of the callee's actuals will still exist in the a-list, and will precede the binding of the caller, e.g. after during the caller's execution, after callee's execution ended, the a-list state will be false and will mislead the lookup.
    There's no test in the project which checks this scenario, and I think at least one should be added.

  2. The aforementioned issue with the binding also means that the a-list won't be restored correctly when lambdas are involved, and an error occurs. That's because the "bind" function doesn't call "set" nor increment "count_sets" directly, so the "count_sets will be smaller than needed when an error occurs and "restore_alist" is called, e.g., not all the "sets" done during the process (with set/defun/ndefun) will be cleared.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions