Overloading based on attributes - is it a good idea?

Atila Neves atila.neves at gmail.com
Wed May 29 09:50:13 UTC 2019


On Wednesday, 29 May 2019 at 02:50:24 UTC, Jonathan Marler wrote:
> On Wednesday, 29 May 2019 at 01:14:04 UTC, Walter Bright wrote:
>> On 5/28/2019 3:12 PM, Jonathan Marler wrote:
>>> [...]
>> Your algorithm will have to work for the worst case, which is 
>> all template code. This is hardly unreasonable, as Phobos is 
>> nearly entirely templates, with cyclical expansions. Worse, 
>> it's not just attribute inference, you proposed different code 
>> paths for different attributes, meaning the graph changes, too.
>>
>> It's a combinatorial explosion.
>
> You do realize that all template code literally compiles to 
> nothing right?
>
> A template isn't code, it's just a "template" that can be 
> instantiated.  If all you have is templates then there's 
> nothing to instantiate them.

I'm pretty sure Walter knows how templates work given that he's 
implemented them twice.


More information about the Digitalmars-d mailing list