Thread overview
[Issue 3452] Can't alias member functions such that the object name is implicitly stored in the alias
Jan 04, 2016
Richard
Dec 17, 2022
Iain Buclaw
January 04, 2016
https://issues.dlang.org/show_bug.cgi?id=3452

Richard <richard.sams@bool.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |richard.sams@bool.at

--- Comment #5 from Richard <richard.sams@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;
}

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=3452

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--
August 28
https://issues.dlang.org/show_bug.cgi?id=3452

anonymous4 <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=6842

--