[DIP] Resolution of Alias Template Parameters in Function Templates

jmh530 john.michael.hall at gmail.com
Mon May 20 14:45:59 UTC 2019


On Saturday, 18 May 2019 at 16:52:45 UTC, Stefanos Baziotis wrote:
> [snip]
>
> Thanks for the information, I was not aware. But, it's not 
> really clear
> what the behaviour should be. Look point 2. here [1]. What I 
> understand
> is that the general idea is to make aliases more identical to 
> what they alias
> rather than distinguishing them.
>
> This DIP is a step towards that.
>
> That seems to be the direction of the compiler source code as 
> well.
>
> On the other hand, the behaviour that you would expect in the 
> examples distinguishes them.
>
> In my opinion, I think that there should be a clear direction 
> towards the one or the other.
> But of course this is not necessarily what you, the community 
> and / or the language
> maintainers want. In that case, because it is a matter of 
> opinion, it is not (fortunately) up to me to decide. We just 
> need to listen to what most people want / care about
> along with some rationale backing it up. :)
>
> That is, in what cases they are different and in what they're 
> not.
> This could be as simple as "only in `is` case they are 
> different" or way
> more complicated.
>
>
> [1] https://dlang.org/spec/declaration.html#alias


Hmm, the link to the DIP isn't working for me now.


My rationale would be that, from a generic code perspective, it 
is very helpful if alias templates behave like aliases (including 
both is expressions and use in functions). There may be good 
reasons why that shouldn't or can't be the case, but I think the 
goal should be on allowing for the most generic code possible.

It may be useful to include in the DIP the cases where alias 
templates can and cannot be used like aliases...



More information about the Digitalmars-d mailing list