A partial template application literal syntax

bearophile bearophileHUGS at lycos.com
Mon Sep 17 06:53:50 PDT 2012


 From this long Reddit post:
http://www.reddit.com/r/haskell/comments/zxcks/haskell_vs_f_vs_scala_a_highlevel_language/c68ybn1

I have seen this linked page:
https://github.com/non/kind-projector

Where it introduces a (fragile) Scala syntax like:
Tuple3[Int, ?, ?]

That is similar to this D, but it's usable in-place:
template IntFirst3(T2, T3) { alias Tuple!(int, T2, T3) IntFirst3; 
}

A comparable hypothetical D syntax, for partial template 
application:
Tuple!(int, ?, ?)

Being it usable in-place, you can use it as:

static asssert(is(Tuple!(int, ?, ?)!(double, float) ==
                   Tuple!(int, double, float)));

It's a fun syntax: Foo!?

Bye,
bearophile


More information about the Digitalmars-d mailing list