Macros Are Different

While reading macro definitions in OnLisp, by Paul Graham, I was reminded that macro programming is different.  A normal program is written with standard considerations to scope, instantiation, state, atomicity, mutability, and the myriad other purposes for bringing code into existence and the meta-detail surrounding it.  Macros are different in that they deal with, among other things, expansions, like:

e=mc^2

I wrote this the other night while simultaneously wrapping my head around macros and wrestling my personal demons:
Macros are wildly untame critters. They expand as text, they get evaluated as code, then expanded, then...they keep expanding and evaluating.  Macros are to programming what quantum is to physics.  Without macros, e=mc^2 would have looked like, "Math Vomited Onto Paper", and Einstein would have sounded incomprehensibly complicated trying to make his physics simply approachable.
"No really! It's called Relativity! There's light and elevators and it's really cool!"
"We're not your relativities, man."
"Dude's crazy. Did you peep his hair?!"
The ability to compress code into expressions that provide contextual meaning without symbolic overload is among the art of macros.  It seems.  I mean, I depend a lot on other people's writing, especially OnLisp, Paul Graham's seminal work on advanced Lisp techniques and macros, though I'm about to start churning out a stack of macros for Awesome Sauce Java - internals and web code.

Macros are an important feature, because they not only help improve readability, they provide expressive power.  There are things you can only do with macros, which is a nice discovery to make.  As examples arise, and code gets written, I'll post it here.  Until then, I'll get back to writing the web code, which is what I was starting to do when I remembered my digression into the science and purpose of macros.

Have a great day!
Michael
2/22/18

Comments

Popular posts from this blog

I Was Studying Exceptions, But Got Confused, So I Luckily Designed The Code Editor Instead

Just a Short Update

A Day Away From a Glowing Screen