Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested scopes are broken #5

Open
booch opened this issue Apr 21, 2021 · 0 comments
Open

Nested scopes are broken #5

booch opened this issue Apr 21, 2021 · 0 comments
Labels
bug Something isn't working right

Comments

@booch
Copy link
Member

booch commented Apr 21, 2021

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.

@booch booch added the bug Something isn't working right label Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right
Projects
None yet
Development

No branches or pull requests

1 participant