~/talk

A few tips for writing macros

Talkat Clojure/conj 2017 · 2017-10-12..10-14· [compilers-and-language-design]
links:none on file
slides:none on file

Nine concrete tips for safer Clojure macros: prefer functions unless controlled evaluation is required; show an example expansion next to the macro; name params with expr suffix so code shows it gets expressions not values; validate assumptions early with asserts or clojure.spec; use syntax-quote and auto-gensym (#) to avoid name collision; ensure each arg is evaluated once; debug with macroexpand-1 + pprint; build expansions via helper functions.

AI-written summary · about

  1. 0:00Intro
  2. 0:39Dont use a macro
  3. 1:43Include an example expansion
  4. 2:16Append expressions
  5. 2:42Capture assumptions
  6. 3:12Backtick operator
  7. 4:15Evaluate multiple times
  8. 4:52Macro Expand 1
  9. 5:48Conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.