News for hackers. Stuff that matters.
Re:Why Lisp macros are cool, a Perl perspective (2005) by Rerarom on Monday December 16, 2019 @07:18PM (#21809148)
That's the kind of misleading text I was talking about in my first comment.
Re:Why Lisp macros are cool, a Perl perspective (2005) by ScottBurson on Monday December 16, 2019 @08:00PM (#21809427)
There is a conceptual distinction between read time, compile time, and run time, but it's only conceptual: all these things happen in a single process in an interleaved manner. When you type an expression into the REPL, first it gets read, then it gets compiled to some extent that depends on the implementation, then it gets run. Some implementations run every expression you type through the full native-code compiler, but others just interpret the expression, expanding any macros as they encounter them. In the latter case, it's switching back and forth between "run time" and "compile time" potentially many times during the interpretation of a single expression.

It is certainly true that macros are a different kind of code from most ordinary code, because what they're doing is different. But importantly, they are written in the same Turing-complete language. I once wrote a program (a C implementation for Lisp Machines) that allowed the user to interactively execute C expressions. Obviously, it had to parse the C code according to the syntax of that language, but the parser produced list structure that consisted entirely of macro calls. The guts of the compiler were implemented as a collection of macros that translated the output of the parser into Lisp Machine Lisp. These macros did things like accessing and updating a symbol table — far beyond what you could do in a C macro.

Re:Why Lisp macros are cool, a Perl perspective (2005) by lispm on Monday December 16, 2019 @09:17PM (#21809847)
I can compile a file to machine code and load it into another process. The file compiler provides the 'compile-time'. The other process then provides 'load-time' and 'run-time'.
Re:Why Lisp macros are cool, a Perl perspective (2005) by ScottBurson on Monday December 16, 2019 @11:01PM (#21810406)
Right, you can also do it that way. I should have said "all these things can happen in a single process in an interleaved manner".
Re:Why Lisp macros are cool, a Perl perspective (2005) by ScottBurson on Tuesday December 17, 2019 @04:02AM (#21811905)
If anyone's still reading, I can't resist adding that I was doing type checking by macro expansion — a technique that was the subject of a 2017 POPL paper [0] — in 1983.

[0] https://www.ccs.neu.edu/home/stchang/pubs/ckg-popl2017.pdf

Re:Why Lisp macros are cool, a Perl perspective (2005) by zeveb on Tuesday December 17, 2019 @09:03AM (#21813483)
That's so cool! Yet another example of Lisp enabling what other languages get in the way of.