On 02/04/2014 08:53 PM, Andrei Alexandrescu wrote:
This part:

Note that, currently D has 9 qualifiers:
- (mutable)
- const
- inout
- inout const (added from 2.065. See issue 6930)
- shared
- shared const
- shared inout
- shared inout const (added from 2.065. See issue 6930)
- immutable

So, if we allow defining arbitrary postblit from A to B copy, you can
define 9 * 9 = 81 postblits!
I don't want to see such horrible D code.

convinced me something has definitely gotten out of hand.

How so?

1. We have _4_ qualifiers. (DMD appears to implement them as 9 separate qualifiers which has led to problems such as not all combinations being implemented from the start.)

2. We can also overload a usual 1-argument/1-return function based only on qualifiers in the stated 81 ways. Why would this be unexpected or even noteworthy?

We must devise a radically simpler solution to object copying,
one that aims straight at solving the fundamental problems we're facing.
Far as I can tell these are it:

1. Reference counting for all objects, including const/immutable/shared.
...
2. Removing head const. You have added the nice conversion qualified(T[]) -> 
qualified(T)[]
upon calling a function. We must look at ways to allow the user a similar 
generalization for type constructors.

If we figure this(this) doesn't help these two problems,

It doesn't help with 2.

its entire existence must be put in question.

Make sure to keep it possible to mark structs non-copyable.

Reply via email to