DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1

Stefanos Baziotis sdi1600105 at di.uoa.gr
Wed Sep 11 18:29:24 UTC 2019

On Wednesday, 11 September 2019 at 17:53:06 UTC, ag0aep6g wrote:
> So you intend to introduce a difference between shorthand and 
> longhand alias templates?

Not necessarily. But let's say I do (as it seems the DIP
does currently) for the rest of this and I will discuss the
alternative I'm thinking in the end.

> That's awful. To me, that would be a reason to reject the DIP.

Indeed. :/
When I wrote this DIP, I hadn't thought about the long-hand
version. That may seem quite naive, but consider that I was
quite new to D and the use cases I was presented then
were using only the short-hand version. FWIW, this DIP and its
use cases / needs were not mine. But I liked the idea and
did the authoring.

> If I understand correctly, you're saying that you want to 
> consider ease of implementation in the compiler.

Not necessarily. That would be good but I'm more concerned
about the complexity and clarity of the DIP.

> That's fine. But:
> 1) It's not obvious that you're actually simplifying the 
> implementation by restricting the feature to the shorthand 
> syntax. Your prototype implementation seems to work just fine 
> with the longhand syntax.

Indeed it's not obvious.

> 2) Even if it happens to be easier to implement, you have to 
> weigh that against adding a surprising special case to the 
> language. I don't think it's going to be a net positive.


So, the alternative:
My first thought is being more high level.
That is, currently the DIP is restricted to alias declarations,
while we can have the same exact semantic entity using a
different type of declaration. This has a lot of subtle details.
Can these declarations have a common way of resolution ?
If yes, maybe this is too high-level and it results in yet
another not-so-formal-but-intuitive description.
If no, should we consider each case separately ? How many are 
they ?
How complicated will the DIP be ?

And it's not clear whether I will have the time to do this.

Tell me what you think.

- Stefanos

More information about the Digitalmars-d mailing list