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

Function closures supported? #20

Open
lemorage opened this issue Jun 15, 2024 · 1 comment
Open

Function closures supported? #20

lemorage opened this issue Jun 15, 2024 · 1 comment

Comments

@lemorage
Copy link

I am wondering if there is any chance we can use function closures here, like JavaScript does, and what is the formal way to do it?

@nobody5050
Copy link
Member

Well this is certainly an interesting question! I read through the MDN's explanation of closures, and some of the examples. I have to say my gut is telling me that Sack's rules on scope make these impossible currently (https://github.com/RandomSoup/sack/tree/1.0.0?tab=readme-ov-file#scope), and porting some of the examples over to Burlap, the reference implementation of Sack indeed did error on the definition of a functi inside of another functi.

However, closures definitely seem very powerful, especially when paired with the lack of classes. If you have any ideas for how they could work, please do feel free to suggest them!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants