digitalmars.D - D string interpolation
- Imperatorn (3/3) Oct 04 2020 Are there any easy ways to achieve string interpolation in D a la
- Mike Parker (13/16) Oct 04 2020 Currently, no. There's a DIP from Adam and Steve currently going
- Imperatorn (2/17) Oct 04 2020 Splendid!
- bitwise (24/44) Oct 04 2020 I hope they change the syntax to favor readers of code, not
- Adam D. Ruppe (4/5) Oct 04 2020 The new draft ditches most the old syntax.
- bitwise (3/8) Oct 04 2020 Thanks =D
- Paul Backus (2/5) Oct 04 2020 https://code.dlang.org/packages/scriptlike#string-interpolation
- Imperatorn (2/8) Oct 04 2020 Looks like an acceptable workaround for now. Thanks!
- mw (9/11) Oct 04 2020 I also have one:
- Imperatorn (2/13) Oct 04 2020 Cool
- mw (3/20) Oct 04 2020 multiple vars separated by ';'
Are there any easy ways to achieve string interpolation in D a la $"Hello {adjective} world"? Thanks
Oct 04 2020
On Sunday, 4 October 2020 at 13:16:53 UTC, Imperatorn wrote:Are there any easy ways to achieve string interpolation in D a la $"Hello {adjective} world"? ThanksCurrently, no. There's a DIP from Adam and Steve currently going through the review process. It recently completed the first round of community review. They intend to make significant revisions, so it will require at least one more round of community review before moving forward. DIP 1036: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1036.md The review summary and links to the discussion & feedback threads: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1036.md#reviews DIP 1036 was an iteration on an earlier DIP by Walter that he and Atila ultimately rejected: https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1027.md
Oct 04 2020
On Sunday, 4 October 2020 at 14:04:04 UTC, Mike Parker wrote:On Sunday, 4 October 2020 at 13:16:53 UTC, Imperatorn wrote:Splendid![...]Currently, no. There's a DIP from Adam and Steve currently going through the review process. It recently completed the first round of community review. They intend to make significant revisions, so it will require at least one more round of community review before moving forward. DIP 1036: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1036.md The review summary and links to the discussion & feedback threads: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1036.md#reviews DIP 1036 was an iteration on an earlier DIP by Walter that he and Atila ultimately rejected: https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1027.md
Oct 04 2020
On Sunday, 4 October 2020 at 14:04:04 UTC, Mike Parker wrote:On Sunday, 4 October 2020 at 13:16:53 UTC, Imperatorn wrote:I hope they change the syntax to favor readers of code, not writers. As with D's templates, reading code is made more difficult by needlessly adding syntactical variations for language features. Example: writefln(i"I ate $apples and ${%d}bananas totaling $(apples + bananas) fruit.");[...][...] so it will require at least one more round of community review before moving forward. DIP 1036: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1036.md$apples$(apples + bananas)If I was trying to quickly scan code to pick out variables, there's two different things I would have to look for. Example:Foo!intFoo!(bool, int)Same problem.Foo;Foo();Same problem. I'm not sure if the reasoning is to try and reduce noise in the "common" case, or to appease people that think not having to type () will actually help them get things done faster, but neither reason seems valid to me. Also, why would the less significant part of the construct be in the curly braces?${%d}bananasWhy not like this?i"{apples} bar"i"{apples + bananas} bar"i"{bananas:%d} bar"Bar!(int)Bar!(bool, int)Bar();Bar();In all honesty, part of the reason I lost interest in D is because of the type of quirks listed above. I don't believe the intended benefit, whatever it may be, is worth the sacrifice of consistency.
Oct 04 2020
On Sunday, 4 October 2020 at 17:53:55 UTC, bitwise wrote:I hope they change the syntaxThe new draft ditches most the old syntax. Not much point talking about it until it is released though, but you'll probably like the new draft a lot more.
Oct 04 2020
On Sunday, 4 October 2020 at 18:09:15 UTC, Adam D. Ruppe wrote:On Sunday, 4 October 2020 at 17:53:55 UTC, bitwise wrote:Thanks =D Awesome.I hope they change the syntaxThe new draft ditches most the old syntax. Not much point talking about it until it is released though, but you'll probably like the new draft a lot more.
Oct 04 2020
On Sunday, 4 October 2020 at 13:16:53 UTC, Imperatorn wrote:Are there any easy ways to achieve string interpolation in D a la $"Hello {adjective} world"? Thankshttps://code.dlang.org/packages/scriptlike#string-interpolation
Oct 04 2020
On Sunday, 4 October 2020 at 14:19:17 UTC, Paul Backus wrote:On Sunday, 4 October 2020 at 13:16:53 UTC, Imperatorn wrote:Looks like an acceptable workaround for now. Thanks!Are there any easy ways to achieve string interpolation in D a la $"Hello {adjective} world"? Thankshttps://code.dlang.org/packages/scriptlike#string-interpolation
Oct 04 2020
On Sunday, 4 October 2020 at 13:16:53 UTC, Imperatorn wrote:Are there any easy ways to achieve string interpolation in D a la $"Hello {adjective} world"?I also have one: https://code.dlang.org/packages/jdiutil ``` // multiple vars separated by ';' // _S with var name; _s without var name writeln(mixin(_S!"with var name: {i; d; thePoint}")); writeln(mixin(_s!"without var name: {i; d; thePoint}")); ```
Oct 04 2020
On Sunday, 4 October 2020 at 16:27:59 UTC, mw wrote:On Sunday, 4 October 2020 at 13:16:53 UTC, Imperatorn wrote:CoolAre there any easy ways to achieve string interpolation in D a la $"Hello {adjective} world"?I also have one: https://code.dlang.org/packages/jdiutil ``` // multiple vars separated by ';' // _S with var name; _s without var name writeln(mixin(_S!"with var name: {i; d; thePoint}")); writeln(mixin(_s!"without var name: {i; d; thePoint}")); ```
Oct 04 2020
On Sunday, 4 October 2020 at 16:31:50 UTC, Imperatorn wrote:On Sunday, 4 October 2020 at 16:27:59 UTC, mw wrote:multiple vars separated by ';' because, you can also pass in `funcCAll(arg, arg2)`On Sunday, 4 October 2020 at 13:16:53 UTC, Imperatorn wrote:Are there any easy ways to achieve string interpolation in D a la $"Hello {adjective} world"?I also have one: https://code.dlang.org/packages/jdiutil ``` // multiple vars separated by ';' // _S with var name; _s without var name writeln(mixin(_S!"with var name: {i; d; thePoint}")); writeln(mixin(_s!"without var name: {i; d; thePoint}")); ```
Oct 04 2020