Re: Copy Constructor DIP and implementation

2018-09-25 Thread Nicholas Wilson via Digitalmars-d-announce

On Tuesday, 25 September 2018 at 12:33:30 UTC, RazvanN wrote:
After discussing with Walter and Andrei we have decided that we 
are going to drop @implicit for now as it may cause bugs (as 
Jonathan has highlighted) and consider constructors that have 
the form this(ref $q1 S rhs) $q2 as copy constructors. I will 
update the DIP with more information.


Also, regarding the cohabitation between postblit and copy 
constructor: in order to make the transition smoother, whenever 
a postblit and a copy constructor are found togheter in a 
struct, the former is used and the latter is ignored (even if 
it is a field postblit). Once the postblit is going to be 
deprecated we can do the opposite and use the copy constructor 
and ignore the postblit.


If @implicit is going to be introduced then that is going to be 
a DIP on its own.


Thanks!

I still think a -dip10xx flag to control which to prefer is worth 
doing, since


a) it won't be hard to do and will make the transition smoother 
still , and


b) IIRC the motivating factor for this is memory safety. Delaying 
memory safety while waiting for a deprecation period to expire ( 
O(years) ) for code that wants to remain backwards compatible 
with older compiler versions is not something we should be 
encouraging.


In the deprecation period if no flag is given prefer postblit to 
copy if both are defined, if flag is given prefer copy over 
postblit.


Nic


Re: Copy Constructor DIP and implementation

2018-09-25 Thread Jonathan M Davis via Digitalmars-d-announce
On Tuesday, September 25, 2018 6:33:30 AM MDT RazvanN via Digitalmars-d-
announce wrote:
> After discussing with Walter and Andrei we have decided that we
> are going to drop @implicit for now as it may cause bugs (as
> Jonathan has highlighted) and consider constructors that have the
> form this(ref $q1 S rhs) $q2 as copy constructors. I will update
> the DIP with more information.
>
> Also, regarding the cohabitation between postblit and copy
> constructor: in order to make the transition smoother, whenever a
> postblit and a copy constructor are found togheter in a struct,
> the former is used and the latter is ignored (even if it is a
> field postblit). Once the postblit is going to be deprecated we
> can do the opposite and use the copy constructor and ignore the
> postblit.
>
> If @implicit is going to be introduced then that is going to be a
> DIP on its own.

Yay! Thank you.

- Jonathan M Davis