dsherret / dsherret/code-block-writer

Declaration and capturing of variables

Open
#37 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
218
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Hi! Thank you for this library!

Is there any way to manage scopes of variables with it? For example, if I do some recursive code generation, at the moment I need to manage scope separately (mostly for capturing outer scope's variables).

Let's assume I generate some matrix processing code, and want to have some recursive function which generates the code. In that case I need to capture previous loop index somewhere, to then access it in the inner loop (and not use same `i` variable name in the inner loop as well):

```js
for (var i = 0; i < 10; i++) {
for (var i0 = 0; i < 10; i++) {
// access here both i and i0
}
}
```

It would be nice to have such feature in the library since it already is managing blocks and other scope-related things.

Sorry if expression of my thoughts is a bit messy, but I hope the issue is clear :D

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.