Comment

Comment by kfoley

I used to have the same issue understanding the benefit. One simple example that helped it clicked for me was considering the `when` or `unless` macro.

They're just very simple macros based around the `if` special form. Because they're macros, they can just treat the body as data, i.e. it's not executed as part of argument resolution.

If you wanted to make a `when` function in Python, the "body" would have to be a callable like a lambda or named function.

I know this probably isn't the most compelling use case but I found it to be a really simple way to understand some of the benefits of macros and how they could be used elsewhere.

parent kfoley 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton