[#109095] [Ruby master Misc#18888] Migrate ruby-lang.org mail services to Google Domains and Google Workspace — "shugo (Shugo Maeda)" <noreply@...>
Issue #18888 has been reported by shugo (Shugo Maeda).
16 messages
2022/06/30
[ruby-core:108949] [Ruby master Feature#18461] closures are capturing unused variables
From:
"matz (Yukihiro Matsumoto)" <noreply@...>
Date:
2022-06-16 06:44:32 UTC
List:
ruby-core #108949
Issue #18461 has been updated by matz (Yukihiro Matsumoto).
Status changed from Open to Rejected
Rejected. Ruby and JavaScript are different languages.
Upon existence of `eval`, the impact of removing unused variables from closures are far bigger in Ruby. The optimization should not be mandatory.
If there's no side effect (e.g. `eval` is never called with the closure), the unused variables might be removed from closures. But it seems nearly impossible to ensure no side effect.
Matz.
----------------------------------------
Feature #18461: closures are capturing unused variables
https://bugs.ruby-lang.org/issues/18461#change-98044
* Author: bughit (bug hit)
* Status: Rejected
* Priority: Normal
----------------------------------------
```rb
def foo
a = 1
->{}
end
p foo.binding.local_variables # [:a]
```
Shouldn't `a` be optimized away? Like v8 does (https://bugs.chromium.org/p/v8/issues/detail?id=3491)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>