Macros and expressiveness

So (obviously) more than six months ago, I asked Why is the macro systems in lisps considered so valuable. This is now closed for comments, but I’d like to link to https://www.youtube.com/watch?v=43XaZEn2aLc&feature=youtu.be which is a PWL talk on expressiveness.
So the talk is basically about if you add a feature f to a language l, will it be more expressive. And it seems like if you can have the feature by rewriting it locally and still be in language l, the feature does not add expressive powers to the language. In Clojure, examples of this would be adding and, or, when when you already have if. Neither and, or, or when will let you express anything you cannot express already using if. And this holds for most of the simpler macro-systems.

So my speculation is that the lisp macro system might be more powerful than this and that it actually is able to add new expressive features to the language, ie features which are not just local rewrites.

Anyways, enough ramblings, go watch the talk. it’s super interesting.

2 Likes

I didn’t watch the talk, but generally I use expressivity and power as separate concept. I think formally they talk about expressive power. So the way I use the terms is that one of them is about how much can be expressed, I would consider that expressive power. In such way, all turing complete languages are equally powerful. And then I use expressivity as how many ways can be used to express things. Not all Turing complete languages are equal here. Some languages, like Lisps, give you way more ways to express the same logic. Finally, I like to also talk about ergonomics of a language, as how natural does a language let you express things, how close to the way you think about it is it, and how efficient does it make you?

And the interesting thing is that, expressivety plays into ergonomics in that the latter often has personal elements, and the expressivity allows you to choose your personally most ergonomic ways or coding. The problem might also land itself better to one way over another way, the classic example being how certain algorithms are easier to implement recursively.

I value expressivity and ergonomics highly. I think they increase a programmers efficiency and the quality of their work. I find it funny when people try to ignore their importance, why don’t you use assembly if it didn’t matter? Why don’t you go back to unstructured programming if these are worthless considerations? And the truth is, generally speaking, it’s that you can convince someone of better ergonomics, they have to try it out themselves first, but often times, you get spoiled as well by better ergonomics, and then you can never go back.

1 Like