Open lemorage opened 3 months ago
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!
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?