Skip to content

Nested scopes are broken #5

@booch

Description

@booch

This code does not work as expected:

Pair := (f, s) => { (x) => { x(f, s) } }
first := (p) => { p((f, s) => { f } ) }
first(Pair(1, 2))

I'm pretty sure that the problem is not trying to call (apply) the passed-in function p, because that's working fine in this code:

TRUE := (t, f) => { t }
or := (this, that) => { this(TRUE, that) }
or(TRUE, TRUE)

I think the problem is that the inner function in Pair isn't able to get f and s. I believe I came across the same issue when I attempted to implement closures (and backed it out when it didn't work right). In fact, I think the actual problem here is that closures aren't working properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions