Bug 1498 – Recursive mixins are not allowed

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-09-13T10:21:00Z
Last change time
2014-02-17T22:51:12Z
Keywords
rejects-valid, spec
Assigned to
nobody
Creator
samukha

Comments

Comment #0 by samukha — 2007-09-13T10:21:18Z
I and other people have asked in the NG about recursive mixins and got no answer. Recursive mixins are probably tricky to implement but until they are implemented or the specs clearly prohibit them, it is a bug (and major one with respect to what I'm trying to do). template Foos(Funcs...) { static if (Funcs.length) { mixin Foos!(Funcs[1..$]); } } mixin Foos!(void function(), void function(int)); Error: mixin hello.Foos!(void(*)(),void(*)(int)).Foos!(void(*)(int)).Foos!() recursive mixin instantiation
Comment #1 by lovesyao — 2007-09-13T10:30:35Z
Reply to [email protected], > http://d.puremagic.com/issues/show_bug.cgi?id=1498 > > Summary: Recursive mixins are not allowed > Product: D > Version: 1.021 > Platform: PC > OS/Version: Windows > Status: NEW > Severity: normal > Priority: P2 > Component: DMD > AssignedTo: [email protected] > ReportedBy: [email protected] > I and other people have asked in the NG about recursive mixins and got > no answer. Recursive mixins are probably tricky to implement but until > they are implemented or the specs clearly prohibit them, it is a bug > (and major one with respect to what I'm trying to do). > > template Foos(Funcs...) > { > static if (Funcs.length) > { > mixin Foos!(Funcs[1..$]); > } > } > mixin Foos!(void function(), void function(int)); > > Error: mixin > hello.Foos!(void(*)(),void(*)(int)).Foos!(void(*)(int)).Foos!() > recursive mixin instantiation > static foreach should cover this
Comment #2 by samukha — 2007-09-13T12:36:44Z
True, but it's going to be D 2.0 feature and remain a bug/undefined behavior in D 1.0 (which I am confined to because of Tango/DFL).
Comment #3 by kamm-removethis — 2009-06-27T10:08:51Z
The test case passes for me with DMD 1.045 and seems to behave correctly.