August 29, 2022
On 8/29/22 4:38 PM, 12345swordy wrote:
> On Monday, 29 August 2022 at 08:45:38 UTC, Andrei Alexandrescu wrote:
>> On 8/29/22 10:43 AM, Martin Tschierschke wrote:
>>> On Friday, 26 August 2022 at 14:22:11 UTC, Mike Parker wrote:
>>>>> [...]
>>> [...]
>>>> [...]
>>>
>>> So thank you Mike and Max, your work and your success is very welcome!
>>>
>>>> [...]
>>>
>>> Ok. My impression from the discussion was, that a new DIP was in preparation in the background - wishful thinking ? :-)
>>
>> John Colvin and myself have had an idea on a DIP for string interpolation. We discussed it with Adam Ruppe and Steven Schveighoffer who found it satisfactory.
>>
>> The work is at a stage where I need to edit the proposal (which is now in a private repo) to reflect that idea. With my changing jobs I didn't have the time to do so. Hopefully either myself or John could carry it forward in the near future.
> 
> Wait, why is it in a private repo?

It's a draft not ready for review. Once it will be ready for review it will be of course published.

August 29, 2022

On Monday, 29 August 2022 at 19:28:05 UTC, Andrei Alexandrescu wrote:

>

It's a draft not ready for review. Once it will be ready for review it will be of course published.

I thought it was public:

https://github.com/John-Colvin/YAIDIP

Or is that an old version?

September 02, 2022

On Friday, 26 August 2022 at 12:57:58 UTC, Martin Tschierschke wrote:

>

Anything new about the status of this language enhancements?

Best regards
mt.

If you need string interpolation yesterday and don't mind using mixins...

import std.stdio;
import std.string;
import std.array;
import std.range.primitives;

string mwrite(string str) @safe pure {
	size_t istart;
	bool inword = false;
	auto result = appender!(string[]);
	auto vars = appender!(string[]);
	foreach (i, dchar c; str) {
		if (!inword) {
			if (c == '{') {
				result.put(str[istart .. i]);
				istart = i+1;
				inword = true;
			}
		} else {
			if (c == '}') {
				result.put("%s");
				vars.put(str[istart .. i]);
				istart = i+1;
				inword = false;
			}
		}
	}
	if (!inword && istart < str.length)
		put(result, str[istart .. $]);

	return format!`writef("%s", %s);`(result.data.join, vars.data.join(`, `));
}
string mwriteln(string str) @safe pure {
	string result = mwrite(str);
	enum toReplace = "writef(";
	return "writefln(" ~ result[toReplace.length .. $];
}

void main() {
	int x = 4;
	float y = 3.5;
	mixin(mwriteln(`X:{x} Y:{y}`));
	mixin(mwriteln(`Which is larger? {x>y?"X":"Y"}`));
}
September 05, 2022

On Friday, 2 September 2022 at 17:17:18 UTC, cc wrote:

>

On Friday, 26 August 2022 at 12:57:58 UTC, Martin Tschierschke wrote:

>

Anything new about the status of this language enhancements?

Best regards
mt.

If you need string interpolation yesterday and don't mind using mixins...

Thanks, very cool result with little coding!

1 2
Next ›   Last »