Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7992715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:38:49+00:00 2026-06-04T13:38:49+00:00

This is a followup to Clojure: pre post functions Goal For every Clojure function,

  • 0

This is a followup to Clojure: pre post functions

Goal

For every Clojure function, I want to have a pre and post function that gets executed:

  • right before the function is evaluated and
  • right after the function returns

    Now, I want to do this all functions in my *.clj files.

    I would prefer (this is also an learning exercise) to do this at the Clojure Compiler level.

Question:

How do I get started on this? What part of the Clojure Compiler source code should I be reading? What documentation / tutorials on the internals of the Clojure Compiler I should be aware of?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:38:51+00:00Added an answer on June 4, 2026 at 1:38 pm

    First off, this sounds like a slightly crazy thing to do in general. There are almost certainly better ways to achieve any sensible objective (i.e. this is screaming “XY Problem“). But as long as you say it is just for a learning exercise, that is fine 🙂

    I can think of a couple of strategies you might want to consider before hacking the compiler:

    • Create your own defn macro that does the wrapping when functions are created. Obviously you’ll need to make sure your own version of defn is used rather than the built-in one. Probably the simplest solution.
    • Walk your namespaces at runtime (after they are loaded) and redefine all functions to a wrapped version of the same function. Could get a bit messy but will certainly enhance your understanding of namespaces 🙂

    If you really want to hack the compiler, the easiest place to make this change would probably be just by hacking defn in core.clj

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a followup to Clojure: Compile time insertion of pre/post functions My goal
This is a followup/post question to another question; as I have discovered a solution
This is a followup to my last question . I now have a byte[]
class Followup < ActiveRecord::Base belongs_to :post belongs_to :comment end This model needs to only
This is a followup from another post at here . Problem: The code below
This is a followup from another post at here . Problem: links aren't been
Hey guys this is a followup to my previous question . I now have
This is a followup to this question. A 2002 paper on the function forwarding
This is a followup to a question I asked yesterday: Have you ever had
This is kind of a followup to this question . I have the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.