On 2015-07-22 21:52, Alex Parrill wrote:

You can make a `conformsToSomeInterface!T` template, and use `static
assert`. D ranges, and the upcoming std.allocator, already use this sort
of 'interfaces without polymorphism'.

Ex. `static assert(isInputRange!(MyCoolRange));`

I would be a lot more cleaner to be able to do this:

void foo (T : MyCoolRange) (T range);

Or just:

void foo (MyCoolRange range);


Most of what macros in C were used for are now done with templates,
static if, etc. (I don't know how Rust's macros work). Tools could
theoretically execute `mixin`, but it effectively requires a D
interpreter. A library to do that would be really nice.

Macros in C have nothing to do with macros in Rust, which are called AST macros or syntax macros. It's unfortunate that they use the same word, "macro".

If D macros you could do something like this:

auto person = Person.where(e => e.name == 'Foo');

Where the lambda would be translated do an SQL string and performs a query in a database.

--
/Jacob Carlborg

Reply via email to