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

Jacob Carlborg via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sat Sep 26 03:28:46 PDT 2015


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

> It's to work around a dmd bug that doesn't allow overloads between
> templates and non-templates.  But I just checked, looks like that bug
> may have been fixed since, so now the following overloads would work:
>
> 	void writefln(string format, A...)(A args) { ... } // current
> 	void writefln(A...)(string format, A args) { ... } // new

1. "writefln" is already a template [1]:

void writefln(Char, A...)(in Char[] fmt, A args)

2. Both of your above examples are templates

3. The easiest way to workaround that bug is to make the non-template 
function a template function without arguments:

void foo()(int a);
void foo(T)(T a, T b);

But if the bug is fixed, then that's great :)

[1] 
https://github.com/D-Programming-Language/phobos/blob/master/std/stdio.d#L1362

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list