|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D.bugs - [Issue 2030] New: String mixin within teplatate mixin doesn't compile
http://d.puremagic.com/issues/show_bug.cgi?id=2030 Summary: String mixin within teplatate mixin doesn't compile Product: D Version: 2.013 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: bartosz relisoft.com The following code doesn't compile: template foo (string init) { mixin ("string str = \"" ~ init ~ "\";"); } mixin (foo !("hello")); attribute argument to mixin must be a string, not (foo!("hello")) Analogous code without a string mixin works: template bar (string s) { string str = s; } mixin bar!("hello"); -- Apr 24 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2030 ary esperanto.org.ar changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #1 from ary esperanto.org.ar 2008-04-24 17:30 ------- No, the analogous code is template bar (string s) { string str = s; } mixin (bar!("hello")); and it doesn't compile (and it shouldn't). Notice the parenthesis after mixin. There's a difference between mixin something; and mixin (something); The first one is a template mixin (http://digitalmars.com/d/1.0/template-mixin.html), the second one is a mixin (http://www.digitalmars.com/d/1.0/mixin.html). This compiles correctly: template bar (string s) { string str = s; } mixin bar!("hello"); -- Apr 24 2008
On 24/04/2008, d-bugmail puremagic.com <d-bugmail puremagic.com> wrote: Apr 24 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2030 ------- Comment #3 from bartosz relisoft.com 2008-04-25 13:16 ------- Yes, it's a parentheses problem. Shows you that making two completely different constructs in a language differ only be parentheses is confusing. -- Apr 25 2008
|