Re: Simplifying a string mixin

2019-02-26 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-02-25 21:57, Victor Porton wrote: Can string mixing be split into several parts? I have a mixin like this:     mixin("struct " ~ name ~ " {\n" ~   "  struct Regular {\n" ~   "    // ..." ~   "  }\n" ~   "  struct WithDefaults {\n" ~   "   

Re: Simplifying a string mixin

2019-02-26 Thread bauss via Digitalmars-d-learn
On Monday, 25 February 2019 at 21:04:48 UTC, Adam D. Ruppe wrote: On Monday, 25 February 2019 at 20:57:37 UTC, Victor Porton wrote: Can string mixing be split into several parts? I have a mixin like this: mixin("struct " ~ name ~ " {\n" ~ " struct Regular {\n" ~ "

Re: Simplifying a string mixin

2019-02-26 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 25 February 2019 at 21:04:48 UTC, Adam D. Ruppe wrote: On Monday, 25 February 2019 at 20:57:37 UTC, Victor Porton wrote: Also, what is the most proper thing to check that `name` is a proper identified (not say !@#)? just let the compiler do it imo. Agreed. There are times when

Re: Simplifying a string mixin

2019-02-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 25 February 2019 at 20:57:37 UTC, Victor Porton wrote: Can string mixing be split into several parts? I have a mixin like this: mixin("struct " ~ name ~ " {\n" ~ " struct Regular {\n" ~ "// ..." ~ " }\n" ~ " struct WithDefaults {\n"

Simplifying a string mixin

2019-02-25 Thread Victor Porton via Digitalmars-d-learn
Can string mixing be split into several parts? I have a mixin like this: mixin("struct " ~ name ~ " {\n" ~ " struct Regular {\n" ~ "// ..." ~ " }\n" ~ " struct WithDefaults {\n" ~ "// ..." ~ " }\n" ~ '}'); I