scope

Ruby refinements for scoped monkey patching

Refinements provide scoped modifications to existing classes without global monkey patching. I use refinements to add methods to core classes safely. Refinements activate with using statement—scope-limited to file or module. Unlike monkey patches, ref

JavaScript closures and lexical scope fundamentals

Closures allow functions to access variables from outer scopes even after outer function returns. I create closures when inner functions reference outer function variables. Lexical scope means functions look up variables where they're defined, not whe