jashkenas / jashkenas/coffeescript
Proposal: Generate wrapper only when needed
Open
enhancement
- Dominant language
- CoffeeScript
- Stars
- 16.6k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
Lately, Google Dart has been getting some well-deserved flack for a trivial "Hello, world" example generating thousands of lines of JS output. Meanwhile, though, CoffeeScript is generating 3 lines when it could be generating just 1. Since
```
console.log 'Hello, world!'
```
contains no scoped variables, I don't see any benefit to generating the output
```
(function() {
console.log('Hello, world!');
}).call(this);
```
instead of just
```
console.log('Hello, world!');
```
I propose that the wrapper only be added when it has an effect on scope. What do other folks think?
Contributor guide
Assessment
This issue has not been assessed yet.