Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Add implicit variable capture on closures #39

Open
gosukiwi opened this issue May 27, 2015 · 1 comment
Open

Add implicit variable capture on closures #39

gosukiwi opened this issue May 27, 2015 · 1 comment

Comments

@gosukiwi
Copy link
Owner

As discussed in #29, right now the variable capture is pretty dumb, so there's a lot of room for better code generation.

I'm moving the topic to it's own issue for better organization.

Andrea's example explains this pretty well:

a = 3
b = 2
c = (z) -> z + b

should compile to

<?php
$a = 3;
$b = 2;
$c = function ($z) use ($b) { return $z + $b; };
@hikari-no-yume
Copy link
Contributor

The most fun case is nested closures.

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

No branches or pull requests

2 participants