# Code Review: LexicalScope2

**URL:** <https://www.ruby-forum.com/t/code-review-lexicalscope2/152102>\
**Category:** IronRuby\
**Created:** [October 30, 2008, 4:37am UTC](https://www.ruby-forum.com/t/code-review-lexicalscope2/152102 "2008-10-30T04:37:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [October 30, 2008, 4:37am UTC](https://www.ruby-forum.com/t/code-review-lexicalscope2/152102/1 "2008-10-30T04:37:24Z")

</div>

tfpt review “/shelveset:LexicalScope2;REDMOND\tomat”

Refactors and simplifies LexicalScope and allocation of local variables.  
Previously a LocalVariable instance was created per each local variable  
access, which is unnecessary. Also, since many scopes don’t define any  
variables at all we allocate a variable dictionary lazily.  
In evals, we used to fallback to dynamic variable lookup in some cases  
even though we could lookup statically.

Tomas
