# Explicitly separating execution

**URL:** <https://discourse.julialang.org/t/explicitly-separating-execution/18957>\
**Category:** General Usage\
**Created:** [December 24, 2018, 7:03am UTC](https://discourse.julialang.org/t/explicitly-separating-execution/18957 "2018-12-24T07:03:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pyrex41](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@pyrex41](https://discourse.julialang.org/u/pyrex41)\
**Post date:** [December 24, 2018, 7:03am UTC](https://discourse.julialang.org/t/explicitly-separating-execution/18957/1 "2018-12-24T07:03:19Z")

</div>

Assuming I have the following structure, where an initial “state” is created which includes “objects” (in my case, custom types consisting of values/arrays/tuples + vector of callback functions), and various functions that may call each other or modify the “objects” in various circumstances. For each subsequent iteration, i have multiple triggers, each of which modifies 1 part of the initial state in some way and may trigger a cascading series of modifications/evaluations via the chain of functions and callback functions in the initial state.

My question: how do I explicitly guarantee that all the evaluations initiated by trigger\_1 are complete before trigger\_2 is initiated? It seems logical to expect this, but I am not entirely sure how the code is being processed under the hood, and this is critical to the model working as designed.

```julia
# initialize state and interactive mechanisms
@eval begin
    obj1
    obj2
    obj3
   func1
   func2
   func3
   {etc...}
end

for i=1:100
    trigger_1(args...)
    trigger_2(args...)
end   

```

---

<div class="post-metadata">

**Author:** ![jameson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jameson/32/23_2.png) [@jameson](https://discourse.julialang.org/u/jameson)\
**Post date:** [December 28, 2018, 5:36pm UTC](https://discourse.julialang.org/t/explicitly-separating-execution/18957/2 "2018-12-28T17:36:39Z")

</div>

All code is run in sequential order, so you can always rely on statement-1 finishing before statement-2 begins

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [December 28, 2018, 5:45pm UTC](https://discourse.julialang.org/t/explicitly-separating-execution/18957/3 "2018-12-28T17:45:47Z")

</div>

As long as you don’t have external observer like another thread or a debugger.
