Ranges

Peter Alexander peter.alexander.au at gmail.com
Fri Mar 18 02:29:51 PDT 2011


On 13/03/11 12:05 AM, Jonathan M Davis wrote:
> So, when you're using a range of char[] or wchar[], you're really using a range
> of dchar. These ranges are bi-directional. They can't be sliced, and they can't
> be indexed (since doing so would likely be invalid). This generally works very
> well. It's exactly what you want in most cases. The problem is that that means
> that the range that you're iterating over is effectively of a different type than
> the original char[] or wchar[].

This has to be the worst language design decision /ever/.

You can't just mess around with fundamental principles like "the first 
element in an array of T has type T" for the sake of a minor 
convenience. How are we supposed to do generic programming if common 
sense reasoning about types doesn't hold?

This is just std::vector<bool> from C++ all over again. Can we not learn 
from mistakes of the past?


More information about the Digitalmars-d-learn mailing list