On 2016-01-31 13:59:06 +0000, Robert M. Münch said:
I like CTFE and the meta programming idea for languages like D.
However, I'm wondering why most (everyone?) is trying to do
meta-programming using the same language as the one getting compiled.
IMO the use-cases a pretty different and doing CTFE, code-generation
etc. needs some other approach. If you look at all the strange template
syntax, strange hacks etc. it's all far from being obvious.
Why not have a CTL (compile-time-language) that has access to some
compiler internals, that follows a more functional concept? We are
evaluating sequences of things to generate code, include / exclude code
etc.
From my experience with the different approaches, functional thinking
is much better suited and simpler to use for CTFE goals.
IMO that would really be a big step ahead. Because you know a hammer,
not everything is a nail...
Here is a link http://terralang.org/ where these guys mix Lua and their
compiled language, to achieve what I was thinking about in the same
line:
"In this use-case, Lua serves as a powerful meta-programming language.
You can think of it as a replacement for C++ template metaprogramming3
or C preprocessor X-Macros4 with better syntax and nicer properties
such as hygiene5."
Maybe this better explains, where I think it makes sense to seperate
the two levels: language for the buidling-step, and language for the
actual solution.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster