From: "bughit (bug hit)" Date: 2022-01-06T00:19:20+00:00 Subject: [ruby-core:106979] [Ruby master Feature#18461] closures are capturing unused variables Issue #18461 has been updated by bughit (bug hit). Interning string literals also breaks code, but it's worth moving in that direction, and here also. Note the following quote from chromium/v8: > The only solution I could think of is that whenever devtools is on, we would deopt all code and recompile with forced context allocation. That would dramatically regress performance with devtools enabled though. "forced context allocation" refers to capturing everything in scope as ruby currently does so this optimization is considered "dramatically" valuable ---------------------------------------- Feature #18461: closures are capturing unused variables https://bugs.ruby-lang.org/issues/18461#change-95809 * 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: