# Code Review: AstImprovements2

**URL:** <https://www.ruby-forum.com/t/code-review-astimprovements2/181134>\
**Category:** IronRuby\
**Created:** [January 6, 2010, 1:59am UTC](https://www.ruby-forum.com/t/code-review-astimprovements2/181134 "2010-01-06T01:59:25Z")\
**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:** [January 6, 2010, 1:59am UTC](https://www.ruby-forum.com/t/code-review-astimprovements2/181134/1 "2010-01-06T01:59:25Z")

</div>

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

```
DLR:
  Adds ExpressionCollectionBuilder (moves the implementation from 

```

IronRuby). This allows to construct optimized expressions via C#  
initializer syntax. Adds a subclass BlockBuilder that can be used to  
build blocks like so:

```
  Expression result = new BlockBuilder {
      expression1,
      ...
      (condition) ? foo : null,
      anotherExpression
  };

  If the expression used in the initializer is null it is skipped.
  If the expression is a sequence of expressions 

```

(IEnumerable) its content is included in the block.  
BlockBuilder defines an implicit conversion to Expression.

```
  Ruby:

  Tree transformation refactorings:
  - Replaces some AstFactory utility methods with AstUtils 

```

equivalents.  
- Creates Lambda explicitly to avoid calls to MakeGenericType.  
- Uses BlockBuilder for building complex blocks.

Tomas
