CTFE thoughts & functional approach
anonymous via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jan 31 07:31:59 PST 2016
On Sunday, 31 January 2016 at 13:59:06 UTC, Robert M. Münch wrote:
> 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.
You're conflating CTFE with the other meta programming tools
here. CTFE is the same language as run-time D, but it doesn't
have strange template syntax. Templates, static if, __traits,
etc. have strange syntax, but they're sort of a different
language already.
Are you maybe wishing for a nicer alternative to templates, etc?
> 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...
I think this is too vague to lead anywhere. At least you should
identify specific problems with D's toolset. And if you have
concrete ideas for improvements, you should desribe them in more
detail, spelling out how they improve upon the status quo.
If you want to have an entirely different meta programming
system, then you should show how it would look like, and how it
would be better than the status quo. I don't think anyone can
make much of "make it more functional". Also, when it's
fundamentally different from what we have now, then I don't see
it getting into D at the moment. The language is not in a phase
of designing fundamentals.
More information about the Digitalmars-d
mailing list