[Issue 7603] Default initializer for ref/out must be an lvalue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 7 14:17:05 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7603



--- Comment #8 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-10-07 14:04:47 PDT ---
I've just realized I shot myself in the foot with this change (well,
partially).

Direct snippet of some code I've used (the main thing to look for is "ref
Set!SymID oldIDs = Set!SymID.init")

    SymID[] getClassTreeImpl(Table)(Class par, Table table, ref Set!SymID
oldIDs = Set!SymID.init, bool skipRoot = false)
    {
        typeof(return) result;

        if (!skipRoot && par.ID !in oldIDs)
        {
            oldIDs.add(par.ID);
            result ~= par.ID;
        }

        foreach (ID, cls; table)
        {
            if (cls.baseIDs.canFind(par.ID))
                result ~= getClassTreeImpl(cls, table, oldIDs);
        }

        return result;
    }

Basically, getClassTreeImpl can be passed an existing set of keys or it will
create a new one if not provided and will update it during recursive calls.

I can fix my code, but I worry if my changeset is going to brake anyone elses
code. I wonder if this trick is used that often.. I guess we'll have to wait
and see.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list