On 6/22/15 3:06 PM, Timon Gehr wrote:
On 06/22/2015 06:11 AM, Andrei Alexandrescu wrote:
Walter and I discussed what auto ref for templates should look like and
reached the conclusion that an approach based on lowering would be best.
I added a proposed lowering to
https://github.com/D-Programming-Language/dmd/pull/4717.

Andrei

"@WalterBright auto ref for templates and non-templates do different
things by necessity. ..."

The proposed lowering also works for template functions.

"... This is not an issue."

Yes it is. Walter is right.

For templates, auto ref generates two copies of the function. Inside, which was generated can be interrogated by using is(param == ref). For non-templates, only one copy of the function is generated. Using is(param == ref) inside should be an error.

The two mechanisms bear many similarities and some differences, too.


Andrei

Reply via email to