# Code Review: YamlRange

**URL:** <https://www.ruby-forum.com/t/code-review-yamlrange/141637>\
**Category:** IronRuby\
**Created:** [June 28, 2008, 2:01am UTC](https://www.ruby-forum.com/t/code-review-yamlrange/141637 "2008-06-28T02:01:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oleg\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@Oleg\_T](https://www.ruby-forum.com/u/Oleg_T)\
**Post date:** [June 28, 2008, 2:01am UTC](https://www.ruby-forum.com/t/code-review-yamlrange/141637/1 "2008-06-28T02:01:52Z")

</div>

tfpt review “/shelveset:YamlRange;REDMOND\olegtk”  
Comment :  
Fixes Range support: implements taguri() and loading Range object from  
yaml.  
Changes constructors to hold a reference to a code context instead of  
EqualityComparer (Range constructors wants it).

---

<div class="post-metadata">

**Author:** ![Oleg\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@Oleg\_T](https://www.ruby-forum.com/u/Oleg_T)\
**Post date:** [June 28, 2008, 3:32am UTC](https://www.ruby-forum.com/t/code-review-yamlrange/141637/2 "2008-06-28T03:32:29Z")

</div>

Why not to add Range constructor w/o CodeContext instead? The context is  
used only to compare bounds. Does YAML actually invoke \<=\> method when  
constructing range?

Tomas

---

<div class="post-metadata">

**Author:** ![Oleg\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@Oleg\_T](https://www.ruby-forum.com/u/Oleg_T)\
**Post date:** [June 28, 2008, 9:12am UTC](https://www.ruby-forum.com/t/code-review-yamlrange/141637/3 "2008-06-28T09:12:45Z")

</div>

## Awesome catch!

Oleg

* * *

From: Tomas M.  
Sent: Friday, June 27, 2008 6:31 PM  
To: Oleg T.; IronRuby External Code R.  
Cc: removed\_email\_address@domain.invalid  
Subject: RE: Code Review: YamlRange

Why not to add Range constructor w/o CodeContext instead? The context is  
used only to compare bounds. Does YAML actually invoke \<=\> method when  
constructing range?

Tomas

---

<div class="post-metadata">

**Author:** ![Oleg\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@Oleg\_T](https://www.ruby-forum.com/u/Oleg_T)\
**Post date:** [June 30, 2008, 8:03pm UTC](https://www.ruby-forum.com/t/code-review-yamlrange/141637/4 "2008-06-30T20:03:22Z")

</div>

Currently YAML just deserializes bound values (as objects) and passes  
then to the Range constructor.  
Do you mean that YAML can check bounds itself before constructing range?

–  
Oleg

---

<div class="post-metadata">

**Author:** ![Oleg\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@Oleg\_T](https://www.ruby-forum.com/u/Oleg_T)\
**Post date:** [June 30, 2008, 8:14pm UTC](https://www.ruby-forum.com/t/code-review-yamlrange/141637/5 "2008-06-30T20:14:32Z")

</div>

After F2F check with Tomas we figured out the CodeContext is still  
needed here.

–  
Oleg
