Steven Schveighoffer wrote:
Hopefully, Andrei will eventually get around to dealing with const in std.container and see what a mess it will become without some sort of tail-const for ranges.

I believe at some point an approach will come forth. Here are a few quick thoughts on this large exchange:

* The discussion this time around reflects a deep and thorough understanding of the issues involved throughout the community.

* I think head-const has its usefulness, and tail-const is obviously in need for serious attention. Ideally we should reach, with no or minimal language changes, the point at which full const is the built-in power tool and head-const and tail-const are library artifacts. I think it's quite easy to define a Final!T template that is head-const, and Rebindable!T is a starting point for tail-const classes. We need to figure a pattern for achieving tail constness for general types.

* Const and immutable will be used less often than in C++. This might seem a weakness to those coming from C++ where const can and should be sprinkled often, but it is a natural consequence of the relative restrictions imposed by const in C++ vs. D. D's const is more restrictive, and as such will find its way in fewer idioms than C++'s.

* Perhaps a good starting point is to look at std.container.SList and see how const(SList!T) can be manipulated.


Andrei

Reply via email to