On Thu, 05 Jun 2014 18:18:33 -0400 Steven Schveighoffer via Digitalmars-d <[email protected]> wrote:
> On Thu, 05 Jun 2014 18:06:01 -0400, monarch_dodra > <[email protected]> wrote: > > > On Thursday, 5 June 2014 at 08:49:18 UTC, Jonathan M Davis via > > Digitalmars-d > >> long days; > >> int seconds; > >> short msecs; > >> d.split!("days", "seconds", "msecs")(&days, &seconds, &msecs); > > > > Please don't use pass-by-pointer in D APIs. It makes it a real > > *nightmare* to ever use the code in a safe context. > > This is similar to getopt and readf. I think it's a good way to show > that a reference is being passed. And like with them, it's impossible to use ref for this, because you can't use ref with variadic template arguments. So, there isn't even any debate as to whether ref or pointers would be nicer. Since it's _impossible_ to use ref for this, there's no choice. Anyone who doesn't want to use pointers can use the overload that returns a struct rather than taking function arguments. If there were a way to use ref with variadic arguments, then we could discuss which is better, but since pointers are the only option, there's no point in discussing it. - Jonathan M Davis
