why doesn't formattedRead take args by ref instead of by pointer?

Dmitry Olshansky dmitry.olsh at gmail.com
Mon May 20 14:06:25 PDT 2013


21-May-2013 00:55, Timothee Cour пишет:
> ping on this.
> Also, same question with std.getopt, which takes by pointer instead of
> by ref.
>

IRC there was a problem with having a heterogeneous variadic 
(=compiler's type tuple) function to preserve ref-ness.
>
> On Thu, May 16, 2013 at 12:54 AM, Timothee Cour
> <thelastmammoth at gmail.com <mailto:thelastmammoth at gmail.com>> wrote:
>
>
>     If I change formattedRead's input signature to:
>     uint formattedRead(R, Char, S...)(ref R r, const(Char)[] fmt, ref S
>     args)
>     and adjusted code accordingly.
>
>     It seems to work fine.
>
>     see implementation here:
>     https://github.com/timotheecour/dtools/blob/master/dtools/overrides/format.d#L29
>     (just run unittests: rdmd --main -unittest dtools/all.d)
>
>     why is std.format. formattedRead taking by pointer instead ?
>     could we change that (with proper deprecation), or add that function?
>
>


-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list