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

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


Also, the approachis 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