On Monday, December 17, 2012 04:06:52 Dan wrote:
> > They'll use ref when it's required for
> > the semantics of what they're doing, but auto ref on function
> > parameters is
> > rare.
>
> When would ref be required for semantics? I am asking this to
> learn the D way - so any guidelines are help
On Monday, 17 December 2012 at 03:23:13 UTC, bearophile wrote:
Then I suggest you to not study std.random because it currently
contains know flaws regarding what you are saying.
Fine, thanks. But which would be recommended to study?
Dan:
Usually the best place to learn the way of a language is
studying its standard libraries,
Then I suggest you to not study std.random because it currently
contains know flaws regarding what you are saying.
Bye,
bearophile
On Sunday, 16 December 2012 at 23:02:30 UTC, Jonathan M Davis
wrote:
You _don't_ take ranges by ref unless you want to alter the
original, which is
almost never the case. Functions like popFrontN are the
exception. And since
you _are_ going to mutate the parameter (since ranges iterate
via mu
On Sunday, December 16, 2012 16:09:45 Dan wrote:
> Is there a general philosophy in D phobos on when to pass by
> value or
> reference? For instance, to find a slice using lowerBound many
> copies
> of the target item, as well as copies of items in the collection
> are
> made (see code example bel
Is there a general philosophy in D phobos on when to pass by
value or
reference? For instance, to find a slice using lowerBound many
copies
of the target item, as well as copies of items in the collection
are
made (see code example below). This seems unnecessary - why not
have
functions like: