On Monday, 13 January 2014 at 23:10:04 UTC, TheFlyingFiddle wrote:
I'm curious, why is the .front property of narrow strings of type dchar?
And not the underlying character type for the string.

The root of the issue is that string literals containing characters which do not fit into signle byte are still converted to char[] array. This is strictly speaking not type safe because it allows to reinterpret 2 or 4 byte code unit as sequence of characters of 1 byte size. The string type is in some sense problematic in D. That's why the fact that .front returns dhcar is a way to correct the problem, it is not an attempt to introduce confusion.

Reply via email to