Skip to content

Instantly share code, notes, and snippets.

@johnmyleswhite
Created October 6, 2020 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnmyleswhite/1ce0c707e11ab77f1ff9142c075087e8 to your computer and use it in GitHub Desktop.
Save johnmyleswhite/1ce0c707e11ab77f1ff9142c075087e8 to your computer and use it in GitHub Desktop.
struct ExpressionThunk
source::Any
thunk::Any
end
macro thunk(e)
quote
ExpressionThunk(
$(QuoteNode(e)),
() -> $(esc(e))
)
end
end
x = 1
t = let y = 2
@thunk(x + y)
end
t.source
t.thunk()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment