# 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:** 7

<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, 6:08am UTC](https://discourse.julialang.org/t/difference-b-w-include-foo-jl-and-eval-parse-readstring-open-foo-jl/7807/7 "2017-12-17T06:08:09Z")

</div>

Fair enough. Thanks for your help though! And I’ll work on a simple example

* * *

Also, [the approach](https://github.com/djsegal/Boot.jl/blob/master/src/attempt_file_load.jl)is a little more brute force than that:

- Keep cycling through all the files’ expression arrays and load every parsed blocks it can
- Terminating when no block is added or no blocks remains (in any file’s expr array)

To keep every file happy (and to prevent `func overwrite` errors):

- you remove `consts`, `functions`, and `structs` from all non-module nodes and their subnodes
- but keep local variables in place (i.e. you load whole files up to the current expression shard)

// obviously some optimizations are in place (e.g. skipping files with prev undef vars that are still undefined)

* * *

And to settle some nerves, i think of Boot.jl as more of a tool than a solution:

- it gives you a hook for loading folders robustly.
- but still allows efficient loading when needed (obviously with more `include/_folder` calls)

// one use case is an MVC web framework that wants to load all controllers into its workspace

---

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