Why foreach(c; someString) must yield dchar

Rainer Deyke rainerd at eldwood.com
Wed Aug 18 20:17:49 PDT 2010


On 8/18/2010 21:12, Jonathan M Davis wrote:
> The one thing about it that bugs me is that it means 
> that foreach acts differently with chars and wchars then it does with everything 
> else, but really, that's a _lot_ less of an issue than the problems that you get 
> with generic programming where you have to special case strings all over the 
> place.

False dichotomy.  If foreach acts differently with chars and wchars than
it does with everything else, then you /do/ need to special case strings
all over the place.

Thought experiment: what happens if you iterate not over 'char[]', but
over 'Array!char'?


-- 
Rainer Deyke - rainerd at eldwood.com


More information about the Digitalmars-d mailing list