Overloading based on attributes - is it a good idea?

Manu turkeyman at gmail.com
Tue May 28 21:53:13 UTC 2019


On Tue, May 28, 2019 at 9:10 AM Andrei Alexandrescu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> int fun(int) pure;
> int fun(int);
>
> pure int gun(int x)
> {
>     return fun(x);
> }
>
> This doesn't work, but on the face of it it's not ambiguous - the second
> overload of fun() would not compile anyway.
>
> I was wondering whether allowing overloading on attributes in general
> would be a good idea. I suspect templates and attribute deduction make
> that difficult.

I have wanted to overload on nothrow-ness before.


More information about the Digitalmars-d mailing list