← Back to context

Comment by frwrfwrfeefwf

1 day ago

yes it's desirable to use non turing complete languages as less shit can go wrong, which is why you need macros. You seem to over estimate the difficulty of writing compiler macros, remember you only need to go from the DSL -> Lisp, not lower it into machine code. The DSL's compose perfectly as well, lower one to another or combination of them + lisp.

Well, compilers have layers - you ain't outputting assembly from the AST layer directly, usually there is some kind of IR. Like LLVM have plenty of layers.

And for a simple DSL you can usually just use a sufficiently expressive language, no need for macros. Like kotlin/Scala has html DSLs that look pretty decent.

For anything more complex though, you can't just "compose stuff", a type system is a global property so for that you literally have to write something way more complex than a local macro should contain.

  • >kotlin/Scala has html DSLs

    these interpreted DSLs aren't at all what I'm talking about. The macro system should be able to compile arbitrary text into anything in the simplest possible way and have it seamless with the rest of the code + able to call into it and build off it.

    A type system is paired with a language, not a global property. You can have language L1 with typesystem T1 compile into (L2,T2), etc. These typesystems can be domain specific and arbitrary as well.

    After reading your posts I recommend you go ahead and learn common lisp macros, it will be more informative than more discussion.