[Issue 3452] Can't alias member functions such that the object name is implicitly stored in the alias
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jan 4 11:48:03 PST 2016
https://issues.dlang.org/show_bug.cgi?id=3452
Richard <richard.sams at bool.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |richard.sams at bool.at
--- Comment #5 from Richard <richard.sams at bool.at> ---
Maybe the same Problem, i want to alias a function name + instance global :
import std.stdio;
public import std.experimental.logger;
alias Warning = Log.Warning1;//ERROR:Not working!?
FLog Log;
shared static this () { Log = new FLog("Test.log");}
class FLog : FileLogger
{
this(string newName) @safe
{
super(newName, LogLevel.info);
Warning("Try "); //Alias ----------- OK -----------------
}
///Name hiding! ok
alias Warning = super.warningf;
//General log Warning Message
void Warning1(string message)
{
try{super.warning(message);}
catch(Exception e){}
}
}
int main(string[] argv)
{
Warning("Try "); //Alias -------------- Fail ------------------
//works if Warning1 is static . . . but then super is not
allowed
Log.Warning1("Try ");//OK
Log.Warning("Try ");//OK
return 0;
}
--
More information about the Digitalmars-d-bugs
mailing list