3 ms·
If you want to take this as a confrontation instead of a discussion I agree it's not worthwhile continuing. My confusion is real. I don't get your point. How d
by noelwelsh 2y ago
If you want to take this as a confrontation instead of a discussion I agree it's not worthwhile continuing.
My confusion is real. I don't get your point. How does "they do what Lisp-style compile-time evaluation has always done: they build up lists" delineate Racket's capabilities compared to Zig? It's false on the surface (syntax objects are not lists) and it's false at a deeper level (macros can do anything). Even if it were true, I don't understand the significance of using lists, or not, as a representation of a program. I know, from experience, you can put any value into a syntax object / list so ¯\_(ツ)_/¯
I don't understand what "Zig comptime is part of the compiling process" means in contrast to Racket. How does this differentiate between the two? Macros provide an API to the compiler, are part of the compiling process, and you can insert, e.g, assembly code generated by a macro into a Racket program (I did this a long time ago).
> Syntax and side effects. Take your pick.
What does this mean? "Take your pick" implies xor, but you use and. Is this a typo?
If you doubt that macros can do arbitrary side-effects, put the following in a file (e.g. "comptime.rkt") and from Racket call (require "comptime.rkt")
#lang racket
(define-syntax when
(lambda (stx)
(begin
(println "Compile-time")
(datum->syntax stx '(println "b")))))
(begin
(println "a")
(when)
(println "c"))
You'll see the output
"Compile-time"
"a"
"b"
"c"
The println in the macro when runs before the code in the begin form evaluates. I.e. it is running at compile-time.
- samatman 2y ago> I don't understand what "Zig comptime is part of the compiling process" means in contrast to Racket. You've made that clear, yes.