[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
expressiveness, was Re: how expressive are they?
What is expressive power?
- to make things shorter
# argh, I already write ( .. ), so I'll ignore this.
- to add a construct to a language that you can only get
by a global transformation of the program otherwise.
Landin said this first. In the 60's, last millenium.
My way-old paper on the Expressive Power of PLs formalizes
this idea and shows that it actually separates languages that
are equivalent to TMs.
People have illustrated with numerous examples that
macros add just this abstraction power. No, not with proofs,
but I conjecture that this is doable within the theory.
Now the question is why/when to use this power.
Why do we abstract?
- to empower readers
A reader is much better off being told upfront that the
author uses a pattern to accomplish a goal; repeating the
pattern over and over again doesn't say just that. The reader
must re-confirm for each instance that it is the same pattern.
- to empower maintainers
Say you want to modify one of your patterns systematically.
I can imagine that I want some log information written to
a file every time the code for ..Foo.. is used. If I abstracted
the syntactic pattern into a macro, I can do this at one place.
I have a *single point of control.* If I didn't, well, then,
I am a poor programmer who needs to spend the weekend looking
for each instance.