On Friday, 16 September 2016 at 23:44:42 UTC, Chris Wright wrote:

On the other hand, in a change of behavior, this will be a cache miss and the template is instantiated twice:

  alias myint = int;
  alias TypeA = Typedef!int;
  alias TypeB = Typedef!myint;
No It would not be a miss the type is the same
And this may or may not be a cache hit:

  alias TypeA = Typedef!(int, 0, "A");
  alias TypeB = Typedef!(int, 0, "A");
This would be a hit.

If someone tries implementing the recursive form of the Fibonacci function with your change in place, they'll have unusably long compile times. However, in the typical case, compile times will be faster (and specific types can more easily receive special treatment as needed).

If someone tries to implement fibobacci as a recursive template ...
well there is no way that can be fast.
With interning or without.

Reply via email to