# I don't know why!

**URL:** <https://www.ruby-forum.com/t/i-dont-know-why/145333>\
**Category:** Ruby\
**Created:** [August 8, 2008, 3:59am UTC](https://www.ruby-forum.com/t/i-dont-know-why/145333 "2008-08-08T03:59:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyung\_won\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/47e85d/32.png) [@Kyung\_won\_C](https://www.ruby-forum.com/u/Kyung_won_C)\
**Post date:** [August 8, 2008, 3:59am UTC](https://www.ruby-forum.com/t/i-dont-know-why/145333/1 "2008-08-08T03:59:44Z")

</div>

– test1.rb –

module M  
module MM  
class C  
end

```
class D < MM::C
end

class E < MM::C; puts self; end

```

end  
end

# =\> M::MM::E

– test2.rb –

module M  
module MM  
class C  
end

```
class D < MM::C
end

#class E < MM::C; puts self; end

```

end  
end

M::MM.module\_eval(“class E \< MM::C; puts self; end”)

# =\> uninitialized constant M::MM::MM (NameError)

– test3.rb –

module M  
module MM  
class C  
end

```
class D < MM::C
end

#class E < MM::C; puts self; end

```

end  
end

M::MM.module\_eval(“class E \< C; puts self; end”)

# =\> M::MM::E

###################

# test2.rb ???

###################

---

<div class="post-metadata">

**Author:** ![Kyung\_won\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/47e85d/32.png) [@Kyung\_won\_C](https://www.ruby-forum.com/u/Kyung_won_C)\
**Post date:** [August 10, 2008, 12:06am UTC](https://www.ruby-forum.com/t/i-dont-know-why/145333/2 "2008-08-10T00:06:02Z")

</div>

On Aug 8, 3:57 am, Kyung won Cheon [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> class E < MM::C; puts self; end
> end
> 
> ```
> 
> # =\> uninitialized constant M::MM::MM (NameError)
> 
> ## ###################
> 
> Posted viahttp://www.ruby-forum.com/.

Well, it’s simple, if you say MM::C inside an M::MM’s module\_eval,  
then it means M::MM::MM::C, and this is undefined. When you say Temp  
\dir from inside C:\Temp, then it means C:\Temp\Temp\dir.
