Suggestion: Remove implicit conversion from T[n] and T[] to T*

Jarrett Billingsley kb3ctd2 at yahoo.com
Thu Nov 30 11:01:30 PST 2006


"Oskar Linde" <oskar.lindeREM at OVEgmail.com> wrote in message 
news:ekn8dq$f5t$1 at digitaldaemon.com...
> Removing the implicit conversion from static arrays (T[n]) and dynamic 
> arrays (T[]) to pointers T* may be quite controversial, but would help 
> clear up some problems and feels like the right step to take.
>
> Motivation:
>
> - Implicit conversions are generally bad. There are cases where they make 
> sense, but those need a very good reason.
> - Both conversions are available by the .ptr property already and by using 
> that the code is clearer and more self documenting.
> - T[] contains both a length and a ptr. Both are needed to retain the 
> information. Symmetrically requiring (a.ptr, a.length) makes sense.
> - Decoupling arrays from pointers somewhat lifts D to a slightly higher 
> abstraction level without losing any power.

I suggested this as well a while ago for much the same reasons, and I still 
support it. 





More information about the Digitalmars-d mailing list