tools.logging

Activity, over time

Daily observations from the public event archive.

Attention

Daily stars & forks

Loading attention chart

Star accumulation

Cumulative stars

Loading star accumulation chart

Pull requests

Daily opens & merges

Loading pull requests chart

Conversations

Daily issues & comments

Loading conversations chart

Community

Daily accounts & reviews

Loading community chart

Releases

Daily releases

Loading releases chart

Mentions

1post · 30d
Nov 40 posts
  1. Reddit · · r/lisp · u/Pzzlrr

    Stuck understanding macros vs functions Yes, it's another one of these. I feel like that scene in Seinfeld when Kramer is able to see hidden image in an abstract painting but Mr. Pitt cannot, to his increasing frustration. Case in point, I'm looking for a clear and simple explanation for this and came across this post >My favorite example for this is the lame idiom you see in Java code: if (log.isDebugEnabled()) { log.debug("expensive" + debug + message); } >This is "better" than just log.debug(...) because with the latter, your expensive log message argument needs to be evaluated even if debug is disabled. However, in a language w/ macros, you just say: (debug (str "expensive" debug message)) >and these considerations are already taken care of for you: github.com/clojure/tools.logging/blob/master/src/… then someone goes >Edit: Ohhh! I see! The message isn't evaluated until after! Got it. >I don't understand why this is special? >Why can't you rewrite log.debug to include the check? func debug(m string) { if log.isDebugEnabled() { log.debug(m); } } >What makes macros special in this case? and I'm over here stuck like "what? where? where???" I'm not getting the epiphany and it doesn't help that they linked to clojure and I can't read clojure. So, can we stick with this example? But can someone really ELI5 for me please? --- Let's say we have pseudocode file isDebugEnabled = True; def doSomeStuff(): ... if (isDebugEnabled) { debug("expensive" + debug + message); } ... Then yes, every time we run doSomeStuff() we will check if debug is enabled. I'm with you there, because 1. We enter the function. 2. Encounter the if statement. 3. Check if isDebugEnabled is true or false at the time. 4. proceed accordingly. Now can I please get a by-the-numbers of how macros make this more efficient? Thanks.

    10 points · 19 comments

Latest stargazers

The last 10 distinct accounts we observed this year.

Most active participants

PR, issue, comment & review events in the past year.

Packages

Scan pending.

Live mentions badge

Show how many posts mention your project in the last 30 days.

Live mentions · last 30 days
clojure/tools.logging mentions in the last 30 days