Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Cool. On the other hand, projects like these suggest to me that Macro systems like Rust's are a bit too powerful.

Not that I know how to make it just enough less powerful.



In my experience Rust macros are painful enough to write to deter people from abusing them too much. Whether that's a bug or a feature, I'll let you decide.


Rust's macro system is actually quite limited (I don't know if it's Turing-complete, but the artificial recursion limit is low enough that even if it is, it's not going to be all that abusable); macros are mostly just good for getting rid of repetitive boilerplate, and community norms (and implementation papercuts) discourage people from reaching for macros willy-nilly.


They are Turing complete, see https://github.com/durka/brainmunch


Not that "Turing complete" matters much. Raw text find-and-replace is Turing complete.


Like the language /// ? (https://esolangs.org/wiki////)


Interesting, but my thoughts were along a simpler route of making a literal Turing machine out of text.

Represent your tape with digits, and your head with a letter. Have an arrow from the letter to the active cell.

  [ 0 0 0 1 1 A->2 2 2 ]
Then the text replacements look like this

  A->2 becomes 1 A->

  2<-A becomes 1 A->

  B->2 becomes <-D 3

  2<-B becomes <-D 3
So two text replacements for every state/symbol combo. And the halt state has no replacements. Easy!

(Plus a replacement from [<- to [0<- and from ->] to ->0] to make the tape infinite.)


Rust macros are intended to be powerful, by design.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: