Getting the overload set of a template

Simen Kjærås simen.kjaras at gmail.com
Mon Apr 23 10:57:59 UTC 2018


On Monday, 23 April 2018 at 08:07:52 UTC, Alex wrote:
> On Monday, 23 April 2018 at 07:49:39 UTC, Simen Kjærås wrote:
>> That's not the definition of lowering used elsewhere, and so 
>> will lead to confusion and misunderstanding. I would strongly 
>> suggest you rethink your definition of lowering.
>
> There is no official definition. That's because some natural 
> rewrite rules are implied, which are very general, I assume...

How official do you want it to be? That's the only definition in 
common use by others in the context of compilers.


> My point, is that if it is impossible to catch all cases of 
> template rewriting (which I'm advocating from the beginning) 
> getOverloads should not be extended to templates, as this would 
> be a fundamental change in the language.

There is no template rewriting taking place in the language today 
- that seems to be a feature you are arguing for. getOverloads 
should return the overloads of a template as they are defined in 
the language today. Template overloads are mentioned in the D 
spec[0], and are clearly a real thing that it's useful to be able 
to manipulate.

You seem to be arguing against a feature on the basis that if the 
language were significantly different from what it is, the 
feature would be confusing. The language isn't that way, so the 
feature isn't confusing in that way.

Having getOverloads return template overloads solves a real issue 
right now, and would be useful even if your suggested change were 
implemented (though the behavior would be slightly different). If 
your suggested feature is impossible to implement, are you 
suggesting we simply throw our hands in the air and give up, 
instead of implementing a useful feature?

--
   Simen

[0]: https://dlang.org/concepts.html


More information about the Digitalmars-d-learn mailing list