Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

Jacob Carlborg via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Sep 25 05:14:30 PDT 2015


On 2015-09-25 02:15, H. S. Teoh via Digitalmars-d-announce wrote:

> I wanted to work on it, but haven't actually gotten to it yet.
> Basically, the idea is relatively simple:
>
> 	// compile-time variant
> 	void writefln(string format="", A...)(A args)
> 		if (format.length > 0)
> 	{
> 		... // implementation here
> 	}
>
> 	// runtime variant
> 	void writefln(string format="", A...)(A args)
> 		if (format.length == 0 && args.length > 0 &&
> 			is(typeof(args[0]) == string))
> 	{
> 		... // current implementation
> 	}

Not sure why you need to complicate it with template constraints. Just 
overload the function?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list