💾 Archived View for idiomdrottning.org › extend-the-language captured on 2023-06-16 at 16:55:18. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-07-16)
-=-=-=-=-=-=-
It’s almost eerie to me how a programming problem can seem completely unsolvable and then you extend the language a bit and suddenly it’s easy.
It’s happened to me most often with Lisps of course, but it can happen with pretty much any language. I remember a few Java occasions, personally, where I put in a functor framework and previously challenging problems suddenly became easy.
More recently (in Scheme) the whole define-ir-syntax thing and especially the matchable variant, define-ir-syntax* has made previously difficult things easy for me.
This is almost ridiculous. It’s such a thin layer (the macro is under ten lines of code), and easily inlineable. So inlineable that I don’t even need to use it, I just need to think in terms of it. Or, write using it but inline it by hand before even passing it to a compiler. (Not that I need to or want to inline it; I'm happy to use it. Just in case I wanna be extra portable or something.)
It’s like there are limits to human thought; limits that we don’t notice ourselves. Sort of like the old “most people can only remember seven things” thing but with problem-solving there’s a lack of awareness of what we can’t conceive (unlike memory where it’s sometimes obvious that it’s being strained).
This is why I’m so into shortcuts and magic and macrology and implicitness in code. (Sorta the opposite philosophy as Zig, although I get that for a systems language or “target” language, Zig’s philosophy is more easily auditable by many eyes.) Sanding off even small corners can be the only thing that was missing to push our thinking over the edge to solve a previously unsolveable problem.
Uh, and by “unsolvable”, I mean unsolvable to me. I’m working on a string DSL thing and I was stuck. Returning to it a few months later but armed with define-ir-syntax* and it’s easy. Other people might not have needed the same macro that helped me; maybe my brain is more limited than theirs. That’s fine. Hopefully they can still be helped by the same principle. Humans are a tool building species. Use tools. Learn (or make) new tools. If you don’t have a hammer you don’t know how to use a nail.