5 ms·
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 l
by mpweiher 8y ago
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.
- simias 8y agoIn 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.
- kibwen 8y agoRust'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.
- gamegoblin 8y agoThey are Turing complete, see https://github.com/durka/brainmunch https://github.com/durka/brainmunch
- Dylan16807 8y agoNot that "Turing complete" matters much. Raw text find-and-replace is Turing complete.
- tomsmeding 8y agoLike the language /// ? (https://esolangs.org/wiki//// https://esolangs.org/wiki////)
- Dylan16807 8y agoInteresting, 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.)
- frewsxcv 8y agoRust macros are intended to be powerful, by design.