# Load vs. instance\_eval

**URL:** <https://www.ruby-forum.com/t/load-vs-instance-eval/163412>\
**Category:** Ruby\
**Created:** [March 20, 2009, 1:50am UTC](https://www.ruby-forum.com/t/load-vs-instance-eval/163412 "2009-03-20T01:50:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt\_neuburg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4af34b/32.png) [@matt\_neuburg](https://www.ruby-forum.com/u/matt_neuburg)\
**Post date:** [March 20, 2009, 1:50am UTC](https://www.ruby-forum.com/t/load-vs-instance-eval/163412/1 "2009-03-20T01:50:47Z")

</div>

Assuming f is an absolute path, is there any important difference  
between load(f) and instance\_eval(File.read(f))? I have been saying the  
latter, but I’m thinking I could equally well say the former… Thx - m.

---

<div class="post-metadata">

**Author:** ![matt\_neuburg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4af34b/32.png) [@matt\_neuburg](https://www.ruby-forum.com/u/matt_neuburg)\
**Post date:** [March 20, 2009, 1:55am UTC](https://www.ruby-forum.com/t/load-vs-instance-eval/163412/2 "2009-03-20T01:55:27Z")

</div>

matt neuburg [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Assuming f is an absolute path, is there any important difference  
> between load(f) and instance\_eval(File.read(f))? I have been saying the  
> latter, but I’m thinking I could equally well say the former… Thx - m.

Never mind, I see now that load pollutes the global namespace. m.
