News for hackers. Stuff that matters.
Re:Compiling at Compile Time by ephaeton on Friday November 08, 2019 @05:57AM (#21481222)
"At runtime, we could use cond for that, but since that is a macro as well, we can’t use it at compile time."

D'oh. Who writes a lisp with macros where you can't use macros at macro-expansion-time??

Re:Compiling at Compile Time by sansnomme on Thursday November 07, 2019 @04:42PM (#21477615)
Re:Compiling at Compile Time by jeff_ciesielski on Thursday November 07, 2019 @06:05PM (#21478248)
I wrote something similar a while back (also in nim): https://github.com/Jeff-Ciesielski/synesthesia

When I stop being so darn busy, I do want to revisit my original project of doing the same thing for a FORTH derivative.

Re:Compiling at Compile Time by windsurfer on Thursday November 07, 2019 @02:58PM (#21476732)
This is horrifying and awesome.
Re:Compiling at Compile Time by rgoulter on Thursday November 07, 2019 @10:26PM (#21479753)
Re:Compiling at Compile Time by gnulinux on Thursday November 07, 2019 @10:02PM (#21479653)
Hah, remember doing this in C++ templates when I learned C++ metaprogramming is Turing complete, back in high school. Named my library yabi "yet another brainfuck implementation". Simpler times.
Re:Compiling at Compile Time by hr0m on Friday November 08, 2019 @05:13AM (#21481070)
Re:Compiling at Compile Time by Doxin on Friday November 08, 2019 @10:47AM (#21483275)
You might be better off linking directly to the source code: https://github.com/m3m0ry/drainfuck/blob/master/source/app.d

For people unfamiliar with D, a mixin is essentially equivalent to compile-time eval. you call mixin() with a string, that call then gets replaced with that string compiled as D code. Combine that with the fact that you can run arbitrary code at compile time in D and you get brainfuck-as-a-DSL in 27 lines of code.

Re:Compiling at Compile Time by w-m on Friday November 08, 2019 @05:46AM (#21481185)
And then there's this compile-time C compiler implemented as C++14 constant expressions of course:

https://github.com/keiichiw/constexpr-8cc

Can be only months now, until somebody combines a constexpr compile-time C-to-WASM compiler with a constexpr compile-time WASM interpreter to run any software ever written, at compile time..

Re:Compiling at Compile Time by lonelappde on Friday November 08, 2019 @09:53AM (#21482689)
That would require emulating all syscalls (side-effects) to get a mock of the Real World inside the compile time environment.
Re:Compiling at Compile Time by enriquto on Saturday November 09, 2019 @03:08AM (#21490300)
the path to glory is a long and arduous one
Re:Compiling at Compile Time by rurban on Thursday November 07, 2019 @04:43PM (#21477628)
Only lisp macros, no magic
Re:Compiling at Compile Time by m463 on Thursday November 07, 2019 @07:03PM (#21478788)
in lisp lambda is the definition of magic
Re:Compiling at Compile Time by rurban on Thursday November 07, 2019 @07:48PM (#21479082)
no, macros are
Re:Compiling at Compile Time by keyle on Thursday November 07, 2019 @07:16PM (#21478900)
Posts like these is why I read HN religiously!