4

I was reading some code just now, and I ran across this line:

(str cache \, \space lru \, \space tick \, \space limit)

This is odd to me. Consecutive literal characters are used, instead of a string containing those characters. I would expect something more like this:

(str cache ", " lru ", " tick ", " limit)

But this is in a core library written by some venerable Clojure veterans, which makes me think that maybe there's a reason. What's the reason? Performance? Or what?

1
  • 1
    I'd guess stylistic choice. More than once I've thought, "Man I hate these stupid quotes.". Commented Jul 13, 2014 at 1:05

1 Answer 1

6

There is no good reason. It probably performs worse than the version with strings, in addition to being uglier. You could also write (join ", " [cache lru tick limit]), which would be my preference, but I can understand choosing to write it out longhand. Using characters instead of strings is inexplicable, though. I can't track down the commit that added this line, because the repo has been destroyed and rebuilt at least twice as it switched names, but I'd wager there was no good reason. Maybe some misguided performance ideas.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.