Skip to content

Stepper: steps appear as if capturing happens #1714

Open
@martin-henz

Description

@martin-henz

The stepper doesn't distinguish variables properly when they are already referring to functions:

https://share.sourceacademy.org/svqdz

function h(f, x) {
    function h(g, x) {
        return x <= 1 ? 1 : 3 * g(f, x - 1);
    }
    return x <= 1 ? 1 : 2 * f(h, x - 1);
}
h(h, 5);

Here, the two h in h(h(5 - 1)) refer to different values:
Screenshot 2024-09-03 at 4 32 03 PM
The fact that they are different becomes clear here:
Screenshot 2024-09-03 at 4 32 17 PM
Note that only one of the h are highlighted as being substituted.

The stepper should make clear that the two h are different by appropriately renaming one of them.

(This is called alpha-renaming, and already done properly for other cases.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions