On Wednesday, 27 May 2015 at 08:14:36 UTC, Kagamin wrote:
On Tuesday, 26 May 2015 at 23:47:41 UTC, Dennis Ritchie wrote:
If this proposal is considered, it is required to propose to
look
at the implementation of macros in Nemerle. Many believe that
it
is in Nemerle macros implemented the most successful compared
to
other modern languages. Of course, the most successful macros
are
implemented in Lisp, but the syntax of the language is poor :)
The problem with declarative macro system is that you would
need to learn yet another language. Possibly turing-complete.
And a declarative turing-complete language is an overkill both
for usage and implementation. Imperative macros get it done in
an intuitive way in the existing language.
But D already has such a declarative language - the one used in
template metaprogramming. I think a macro system that plays well
with that template metaprogramming sub-language will be really
nice. For example, CTFE that works like a macro and returns
types/aliases:
Auto deduceType(Auto args) {
// some complex imperative code to deduce the type from
the args
return DeducedType;
}
struct Foo(T...) {
deduceType(T) value;
}