Filling a char array with letters and element type of char[]

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 3 11:38:30 PST 2015


On 3/3/15 2:32 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
> On Tuesday, March 03, 2015 08:50:35 Steven Schveighoffer via Digitalmars-d-learn wrote:
>>>> What is the type of char array holds why it does not matches char?
>>
>> Because D is schizophrenic ;) Phobos considers char[] arrays not to be
>> arrays of char, only ranges of dchar. Unless you talk to the compiler,
>> where it happily treats char[] as an array.
>
> I think that at this point, most of the core developers think that
> auto-decoding was a mistake, but fixing it would definitely be a bit of a
> mess, and whenever it comes up, Andrei complains that we need to focus on
> other things and that we're blowing it out of proportion. :|
>
> I think that the auto-decoding was well-intentioned and an interesting
> experiment, but ultimately, it's causing too many problems...

Sure, but I think that for phobos to say you can't fill a large char[] 
with a repeat of small char[], but you can fill a large int[] with a 
repeat of small int[], is more of a problem than somehow fixing the 
underlying situation.

Other algorithms treat char[] specially. fill should too.

-Steve



More information about the Digitalmars-d-learn mailing list