www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 705] New: Mixins and auto

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=705

           Summary: Mixins and auto
           Product: D
           Version: 0.177
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: thomas-dloop kuehne.cn


(Originally posted by Chris Sauls <ibisbasenji gmail.com> on
2005-12-10 as news:dneava$evs$1 digitaldaemon.com)

Might be a bug, or might be me doing something silly, but this doesn't work as
expected:
































The output I expected being:
 | + A
 | - A
 | + B
 | - B
 | + C
 | - C
 | + A2
 | - A2
 | + B2
 | - B2
 | + C2
 | - C2

The output I am getting:
 | + A
 | + B
 | + C
 | + A2
 | - A2
 | + B2
 | - B2
 | + C2
 | - C2
 | - C
 | - B
 | - A

Eh?  Apparently the "auto" variables declared by the mixins aren't getting
collected until the end of the entire function, my anonymous blocks be damned,
and in reverse order.  And in case anyone wonders, no it doesn't change if I
place more code in the blocks.  I ran across this little beaut looking for a
way to conditionally compile in my Timer objects with somewhat cleaner reading
code. (I like the look of `mixin MTimer!("void main()");` better than `version
(Timer) auto Timer t = new Timer("void main()");` ... I guess I'm crazy.)


test cases:
http://dstress.kuehne.cn/run/a/auto_13_A.d
http://dstress.kuehne.cn/run/a/auto_13_B.d


-- 
Dec 21 2006
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=705


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |bugzilla digitalmars.com


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