digitalmars.D.bugs - [Issue 6776] New: attributes injected via pure template mixin but not class mixin
- d-bugmail puremagic.com (36/36) Oct 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6776
- d-bugmail puremagic.com (20/20) Feb 12 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6776
http://d.puremagic.com/issues/show_bug.cgi?id=6776 Summary: attributes injected via pure template mixin but not class mixin Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: dlang chilon.net --- Comment #0 from pelo <dlang chilon.net> 2011-10-06 04:01:43 PDT --- import std.stdio; class C(T) { T val; } class D { mixin C!bool; } int main() { auto d = new D; writeln(d.val); return 0; } This fails to compile (no val in D), yet if defining C as: template C(T) { T val; } It works. This is rather silly as it forces me to write wrapper classes that forward to a template. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6776 Stewart Gordon <smjg iname.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |smjg iname.com Resolution| |INVALID --- Comment #1 from Stewart Gordon <smjg iname.com> 2012-02-12 15:52:33 PST --- There's no such thing as a class mixin. One mixes in template instances, not classes. Since a class template is just syntactic sugar for a template with an eponymous class as its only member, the compiler expands it to: class D { class C { bool val; } } So of course there's no such thing as d.val. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 12 2012