Re: Multiline string literal improvements

2017-10-13 Thread Igor via Digitalmars-d
On Friday, 13 October 2017 at 07:59:36 UTC, Biotronic wrote: D version that works in CTFE: Thanks Biotronic! This is just what I had in mind.

Re: Multiline string literal improvements

2017-10-13 Thread Biotronic via Digitalmars-d
On Tuesday, 10 October 2017 at 22:16:00 UTC, sarn wrote: On Tuesday, 10 October 2017 at 21:38:41 UTC, captaindet wrote: string a = |q{ firstLine(); if (cond) { secondLine() }   }; you could write your own

Re: Multiline string literal improvements

2017-10-12 Thread Dmitry Olshansky via Digitalmars-d
On Thursday, 12 October 2017 at 16:59:46 UTC, Meta wrote: On Thursday, 12 October 2017 at 08:08:17 UTC, Igor wrote: I tried this but Disassembly view shows: [snip] Hmm, you're right. I could've sworn that std.regex is CTFE-friendly but it looks like I was wrong. If it used the GC instead o

Re: Multiline string literal improvements

2017-10-12 Thread Meta via Digitalmars-d
On Thursday, 12 October 2017 at 08:08:17 UTC, Igor wrote: I tried this but Disassembly view shows: call std.regex.regex!string.regex and call std.regex.replaceAll!(string, char, std.regex.internal.ir.Regex!char).replaceAll which means that replaceAll with regex is done at runtime, not compil

Re: Multiline string literal improvements

2017-10-12 Thread Igor via Digitalmars-d
On Wednesday, 11 October 2017 at 14:28:32 UTC, Meta wrote: On Wednesday, 11 October 2017 at 09:56:52 UTC, Igor wrote: On Wednesday, 11 October 2017 at 08:35:51 UTC, Walter Bright wrote: On 10/10/2017 3:16 PM, sarn wrote: Works even better in D because it can run at compile time. Yes, I see n

Re: Multiline string literal improvements

2017-10-12 Thread Jacob Carlborg via Digitalmars-d
On 2017-10-11 10:35, Walter Bright wrote: On 10/10/2017 3:16 PM, sarn wrote: Works even better in D because it can run at compile time. Yes, I see no need for a language feature what can be easily and far more flexibly done with a regular function - especially since what |q{ and -q{ do gives

Re: Multiline string literal improvements

2017-10-11 Thread Meta via Digitalmars-d
On Wednesday, 11 October 2017 at 09:56:52 UTC, Igor wrote: On Wednesday, 11 October 2017 at 08:35:51 UTC, Walter Bright wrote: On 10/10/2017 3:16 PM, sarn wrote: Works even better in D because it can run at compile time. Yes, I see no need for a language feature what can be easily and far mo

Re: Multiline string literal improvements

2017-10-11 Thread Igor via Digitalmars-d
On Wednesday, 11 October 2017 at 08:35:51 UTC, Walter Bright wrote: On 10/10/2017 3:16 PM, sarn wrote: Works even better in D because it can run at compile time. Yes, I see no need for a language feature what can be easily and far more flexibly done with a regular function - especially since

Re: Multiline string literal improvements

2017-10-11 Thread Walter Bright via Digitalmars-d
On 10/10/2017 3:16 PM, sarn wrote: Works even better in D because it can run at compile time. Yes, I see no need for a language feature what can be easily and far more flexibly done with a regular function - especially since what |q{ and -q{ do gives no clue from the syntax.

Re: Multiline string literal improvements

2017-10-10 Thread sarn via Digitalmars-d
On Tuesday, 10 October 2017 at 21:38:41 UTC, captaindet wrote: string a = |q{ firstLine(); if (cond) { secondLine() }   }; you could write your own string processing function according to your needs FWIW

Re: Multiline string literal improvements

2017-10-10 Thread captaindet via Digitalmars-d
string a = |q{ firstLine(); if (cond) { secondLine() }   }; you could write your own string processing function according to your needs to filter the code string, and use it like string a = inject(q{...})