June 09, 2015 [Issue 2646] Named mixins and member functions | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=2646 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|D1 & D2 |D2 -- |
September 10, 2019 [Issue 2646] Named mixins and member functions | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=2646 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |razvan.nitu1305@gmail.com Resolution|--- |INVALID --- Comment #3 from RazvanN <razvan.nitu1305@gmail.com> --- Mixin templates are evaluated in the context of the instantiation scope. It doesn't matter if a name is given to it or not. For example: template Signal() { void connect() {}; } class CheckBox { mixin Signal toggled; } void main() { auto a = new CheckBox(); a.connect(); } This code compiles successfully. You don't have to call `a.toggled.connect`. This is possible because connect is inserted in the scope of CheckBox (e.g. in the overload set of that scope level). Changing this would make mixing functions very difficult to work with. Closing as invalid. -- |
Copyright © 1999-2021 by the D Language Foundation