From: "matz (Yukihiro Matsumoto)" Date: 2022-06-16T06:44:32+00:00 Subject: [ruby-core:108949] [Ruby master Feature#18461] closures are capturing unused variables 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: