On 03/28/2018 12:19 AM, arturg wrote:
shouldn't it create a overload?

I don't think so. As far as I know, you can't overload on attributes.

[...]
but this works:

class A
{
     void talk() {}
}

class B : A
{
     alias talk = A.talk;
     void talk(int) {}
}

Because different parameters make overloads.

this works also:

class C
{
     void talk()@system {}
     void talk()@safe {}
}

DMD might accept that, but I don't think it works in a meaningful way. How do you call the @system one?

Looks like the @safe one will always be called, even from @system code:

----
import std.stdio;

void talk() @system { writeln("@system"); }
void talk() @safe { writeln("@safe"); }

void main() @system
{
    talk(); /* Prints "@safe". */
}
----

Reply via email to