# Difference b/w include("foo.jl") and eval(parse(readstring(open( "foo.jl" ))))

**URL:** <https://discourse.julialang.org/t/difference-b-w-include-foo-jl-and-eval-parse-readstring-open-foo-jl/7807>\
**Category:** Internals & Design\
**Created:** [December 16, 2017, 10:31pm UTC](https://discourse.julialang.org/t/difference-b-w-include-foo-jl-and-eval-parse-readstring-open-foo-jl/7807 "2017-12-16T22:31:27Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![djsegal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djsegal/32/13752_2.png) [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Post date:** [December 17, 2017, 5:17am UTC](https://discourse.julialang.org/t/difference-b-w-include-foo-jl-and-eval-parse-readstring-open-foo-jl/7807/5 "2017-12-17T05:17:29Z")

</div>

> [@ihnorton](#):
>
> I’m not sure I understand the question – include from where? Wouldn’t that just be eval?

Let’s say you first entirely parse a file stream into an array of expressions.

Then you `eval` the parsed expressions one at a time.

There are some cases where macro nodes get compiled with currently undefined `structs`, `generated functions`, `inlined functions`, etc.

If you tried to do an `include_string` on a string composed of the same data (as the expression), an error would be raised.

Therefore it is sometimes preferable to load the expression naively (expecting the worst) instead of an eval?

* * *

**edit:** this might deal with the state of a package’s compiler (and stale parsed expression trees)?

maybe it just goes back to:

- [Way to get string representation of an Expression?](https://discourse.julialang.org/t/way-to-get-string-representation-of-an-expression/7778?source_topic_id=7702)

---

_[View the full topic](https://discourse.julialang.org/t/difference-b-w-include-foo-jl-and-eval-parse-readstring-open-foo-jl/7807)._
