<div>That was indeed what I was using in my updated ref based reimplementation of <span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">formattedRead (see my original post for the link), and the other functions getopt, readf) are the same AFAIK. </span> </div>
<div><br></div><div>so why not add it to phobos:</div><div>it's safer (no null / invalid pointers)</div><div>simpler user code</div><div>more consistent with rest of phobos</div><div><br></div><div>we could either make the existing by pointer functions enter a deprecation path, or add a '<span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">formattedReadRef'</span> version for all those functions.</div>
<div><br></div><div>Thoughts?</div><div><br></div><div><br></div><div><br></div><br><div class="gmail_quote">On Mon, May 20, 2013 at 2:28 PM, Dmitry Olshansky <span dir="ltr"><<a href="mailto:dmitry.olsh@gmail.com" target="_blank">dmitry.olsh@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">21-May-2013 01:19, Timothee Cour пишет:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
IRC there was a problem with having a heterogeneous variadic<br>
(=compiler's type tuple) function to preserve ref-ness.<br>
<br>
<br></div><div class="im">
could you please provide a code snippet demonstrating this?<br>
<br>
<br>
</div></blockquote>
<br>
Here:<br>
<br>
void readf(Args...)(const(char)[] fmt, Args args)<br>
{<br>
...<br>
}<br>
<br>
the problem was that you couldn't do<br>
<br>
void readf(Args...)(const(char)[] fmt, ref Args args)<br>
{<br>
...<br>
}<br>
<br>
and have each of args be a 'ref' to original var as there is no such things outside function arguments declaration. I dunno how it was solved but this now works:<br>
<br>
void readf(Args...)(const(char)[] fmt, ref Args args)<br>
{<br>
foreach(i, v; args)<br>
args[i] = i;<br>
}<br>
<br>
void main(){<br>
int i, j, k;<br>
readf("abc", i, j, k);<br>
assert(i == 0);<br>
assert(j == 1);<br>
assert(k == 2);<br>
}<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Dmitry Olshansky<br>
</font></span></blockquote></div><br>