Fun with templates
art.08.09 at gmail.com
Sat Jul 6 08:38:30 PDT 2013
On 07/06/13 17:10, Dicebot wrote:
> On Saturday, 6 July 2013 at 15:05:51 UTC, Artur Skawina wrote:
> It is not that simple. Consider:
> void f(T)(T t)
> static if (T == Unqual!T)
> // one function body
> // completely different one
> Currently every template instance is completely independent and tied to exact type. I don't know of any tool to express "group of related types" concept in D other than built-in "inout".
This is exactly why i did mention that this is a breaking change and that
"there shouldn't be much code out there that sensibly relies on the 1:1
type propagation." Do you think this would be a problem /in practice/?
Right now IFTI chooses an expensive alternative, which is rarely required.
You have to do more work to "undo" the unnecessary type propagation. This
is the wrong default. "auto" makes things even worse, by increasing the
number of different-but-compatible types and causing them to propagate.
More information about the Digitalmars-d