Hacker News new | ask | show | jobs
by noduerme 1077 days ago
The answer is great, but I'm questioning its underlying assumption of what "expressiveness" really means, upon which the remainder of the explanation rests.

>> We can get closer to a formal statement by saying: a feature does not "add expressive power" if we can implement it as a macro that turns it into something in the original language

If adding features that could be implemented as macros doesn't make the language more "expressive", then the inverse should be true: Removing features that could be implemented as macros would not make a language less "expressive".

This seems to favor c++, in which basically anything imaginable can be done with macros, and any other language can be implemented. There's no global-level total thing that's missing which can't be cleverly built at an inline level. Yet all of c++'s granularity in memory management requires a huge amount of verbosity, which is to say it isn't as expressive (to me) as something that just runs garbage collection out of the box and makes assumptions about weak vs. strong references and lets you tinker with them if or when you like.

"Expressive" to me implies being able to get a lot of meaning across in a few choice words, whilst having a broad vocabulary to choose from.

Does adding .reduce() add no expressiveness to Javascript, just because it's easily implemented with a macro? I'd argue it adds a lot, because it adds a new color to the palette; it gives rise to styles of programming that allow one to distinguish intentionally between normal loops and functional recursion, and choose, i.e. express, the music according to their own intent.

2 comments

> This seems to favor c++, in which basically anything imaginable can be done with macros, and any other language can be implemented.

Pfft. C++ macros can't even run a different compiler:

https://github.com/m-ou-se/nightly-crimes/blob/main/yolo-rus...

uh, what? Random Rust code?
That's the heart of Mara's Rust proc macro nightly_crimes!

This macro allows you to use Rust's unstable nightly features from your stable Rust programs, in some sense this is clearly silly and can't work, but it actually works fine†. The proc macro is allowed to run software, in this case it destroys the running compiler and launches a different compiler, then it tidies up the resulting mess.

† In a very literal sense, obviously in principle you should never use this, that's why it is named nightly_crimes! not perfectly_reasonable_idea!

>>> a feature does not "add expressive power" if we can implement it as a macro that turns it into something in the original language

But a macro is just an integrated language that lets us emulate more expressive features. To me that's no different from implementing a more expressive language in a simpler one, so this claim seems equivalent to saying all Turing-complete languages have the same expressive power because you can emulate them in each other.

Well put.