Overloading based on attributes - is it a good idea?

Mike Franklin slavo5150 at yahoo.com
Wed May 29 13:53:37 UTC 2019


On Tuesday, 28 May 2019 at 16:08:38 UTC, Andrei Alexandrescu 
wrote:
> int fun(int) pure;
> int fun(int);
>
> pure int gun(int x)
> {
>    return fun(x);
> }

I think it really depends on the attribute.  I haven't thought 
too much about the other attributes, but for `pure` I don't see 
the use case.  If you can make the implementation of `fun(int)` 
pure, why would you need an additional impure implementation?

Mike



More information about the Digitalmars-d mailing list