RFC: naming for FrontTransversal and Transversal ranges

Jason House jason.james.house at gmail.com
Thu Apr 30 15:35:16 PDT 2009


Rainer Deyke Wrote:

> Michel Fortin wrote:
> > On 2009-04-29 23:01:39 -0400, Rainer Deyke <rainerd at eldwood.com> said:
> >> Andrei Alexandrescu wrote:
> >>> 3. Reference semantics
> >> I'm strongly opposed to this option.  Either of the other options would
> >> be acceptable.
> > 
> > Andrei mentioned a couple of reasons against 3, which are yours?
> 
> I agree with all of Andrei's reasons.
> 
> In addition, there's this: suppose you have a struct containing a
> (mutable) array.  When you make a copy of that struct, you will almost
> always want to make a copy of the contained array.  Therefore value
> semantics should be the default, because it simplifies the most common
> use case.

I don't think copying an array member in a struct is as automatic as you imply. We really should figure out use cases that would or would not benefit from a copy. I'm sure we can find lazy range examples where copying would be a performance killer. Also, how deeply should copying go? Does it make sense to do a shallow copy of an array of reference types? What about passing an array into a function?



More information about the Digitalmars-d mailing list