-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added test showing more that forms introduced by macros do not inadve…
…rtedly capture lexical variables at use site
- Loading branch information
1 parent
d41cbd8
commit f602061
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## `macro-generating-macro-2.ts` | ||
|
||
### Status: `DONE` | ||
|
||
### Input Program | ||
|
||
```typescript | ||
using_syntax_rules( | ||
[capture, | ||
capture(expr, id, body), | ||
using_syntax_rules([id, id, expr]).rewrite(body)], | ||
).rewrite((x) => { | ||
const using_syntax_rules = 10; | ||
// capture introduces a using_syntax_rules form but that is | ||
// referentially transparent .. i.e., it doesn't care about | ||
// what's defined in its use site. Capture always works, no | ||
// matter where you put it. | ||
capture(x, t, (x) => x + t); | ||
}) | ||
``` | ||
|
||
### Output Program | ||
|
||
```typescript | ||
(x_5) => { | ||
const using_syntax_rules_8 = 10; | ||
(x_13) => x_13 + x_5; | ||
}; | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using_syntax_rules( | ||
[capture, | ||
capture(expr, id, body), | ||
using_syntax_rules([id, id, expr]).rewrite(body)], | ||
).rewrite((x) => { | ||
const using_syntax_rules = 10; | ||
// capture introduces a using_syntax_rules form but that is | ||
// referentially transparent .. i.e., it doesn't care about | ||
// what's defined in its use site. Capture always works, no | ||
// matter where you put it. | ||
capture(x, t, (x) => x + t); | ||
}) |