# Pre-Lowering Cassette?

**URL:** <https://discourse.julialang.org/t/pre-lowering-cassette/102213>\
**Category:** General Usage\
**Tags:** metaprogramming\
**Created:** [July 28, 2023, 8:21pm UTC](https://discourse.julialang.org/t/pre-lowering-cassette/102213 "2023-07-28T20:21:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [July 28, 2023, 8:21pm UTC](https://discourse.julialang.org/t/pre-lowering-cassette/102213/1 "2023-07-28T20:21:46Z")

</div>

I’ve been working with Cassette, and it’s awesome. Its docs are so good at teaching. I’m not sure if it was @oxinabox who wrote them or what but thank you!

I’m running into some challenges working with the IR, and it’s making me wish I could just do my thing at the Macro level… So here comes the actual question:

My goal is to wrap every single function body with

```julia
function f()
    try
        #original body here...
    catch e
        # my injected logic
    end
end

```

I could do this with `@try_inject function...` but I want to do this for all functions that are defined within a certain context.

Is there a way to hook into JuliaSyntax.jl to intercept the parsing before it goes to lowering and apply my own transforms?

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [July 28, 2023, 8:59pm UTC](https://discourse.julialang.org/t/pre-lowering-cassette/102213/2 "2023-07-28T20:59:36Z")

</div>

I did not write anything much to do with Cassette. Probably @jrevels .

I did start to prototype Arborist.jl to work at the Expr level,  
but i never finished it
