From: "bughit (bug hit)" Date: 2022-01-06T17:38:33+00:00 Subject: [ruby-core:106987] [Ruby master Feature#18461] closures are capturing unused variables Issue #18461 has been updated by bughit (bug hit). > uncaptured ones are on the stack and disappear with the stack frame. You can't get them back later. That's actually one of the major benefits of optimized capture, you're not wasting memory holding on to things you don't need. There could be huge object graphs pointlessly inadvertently kept alive by unoptimized capture. ---------------------------------------- Feature #18461: closures are capturing unused variables https://bugs.ruby-lang.org/issues/18461#change-95818 * Author: bughit (bug hit) * Status: Open * 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: