#dbugfix Issue 16486 200$
Simen Kjærås
simen.kjaras at gmail.com
Sat Mar 31 13:00:40 UTC 2018
On Friday, 30 March 2018 at 17:10:22 UTC, 9il wrote:
> On Friday, 30 March 2018 at 13:56:45 UTC, Stefan Koch wrote:
>> On Friday, 30 March 2018 at 06:11:22 UTC, 9il wrote:
>>> [1] https://issues.dlang.org/show_bug.cgi?id=16486
>>
>>
>> Solving this may be possible for special cases but in the
>> general case is infeasible.
>
> Can the case where the name of original template in scope of
> the alias template refers to an unique template template be
> implemented? It should be good enough for Mir and Phobos.
>
> // There are unique defs for OriginalTemplate and ParamsMap
> import lala : OriginalTemplate, ParamsMap;
> alias AliasTemplate(SomeParams...) =
> OriginalTemplate!(ParamsMap!SomeParams);
Depends greatly on what ParamsMap does. Probably the simplest
counterexample:
alias ParamsMap(T...) = int;
So I have this instance of OriginalTemplate!int - did it come
from an AliasTemplate!int? Maybe it was AliasTemplate!string, or
AliasTemplate!(1,2,3,MyClass) - there's just no way to know.
Of course, that's an extreme example, but the fundamental
requirement is that ParamsMap needs to be injective - each
possible output would need to map to exactly one input. Also,
this mapping must be possible to reverse-engineer.
If we are to support this, a DIP must be written to explain the
algorithm to reverse the mapping. This is absolutely possible for
a subset of cases, and would be a benefit in those cases. Of
course we also run the risk of creating more confusing corner
cases, and an influx of questions in D.learn of people asking
'why does X work, but not Y?'.
--
Simen
More information about the Digitalmars-d
mailing list