← Back to context

Comment by shasta

15 years ago

I think the reason that S-expressions haven't gone away is mostly because of the way they mesh with macros, but anyway the sub-optimality of S-expressions as a syntax wasn't a part of my argument there (I don't like them, but I don't hate them). In that quote, I meant there that all code, even S-expressions, is a human readable expression that defines the thing you're interested in.

Note that it's considered poor form in Lisp to make a square macro that multiplies its parameter by itself. That should be a function. Why? Because numbers have the structure you want them to have. A function that takes a number and multiplies it by itself is just simpler than a function that takes an expression for a number, and pastes it together with an astericks and then returns that to be evaluated. And because the function has a better structure than a macro, it's more composable.

The thing is that this same situation exists with most other uses of macros. In a language with staged computation and maybe a little well tamed syntax extension, I think there would be no place for macros. You can do better.