The Case Against Autodecode

Jack Stouffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 1 14:30:25 PDT 2016


On Wednesday, 1 June 2016 at 19:52:01 UTC, Andrei Alexandrescu 
wrote:
> foreach (dchar x; a) {}
> The latter two do autodecoding, not coversion as the rest of 
> the language.

This seems to be a miscommunication with semantics. This is not 
auto-decoding at all; you're decoding, but there is nothing 
"auto" about it. This code is an explicit choice by the 
programmer to do something.

On the other hand, using std.range.primitives.front for narrow 
strings is auto-decoding because the programmer has not made a 
choice, the choice is made for the programmer.


More information about the Digitalmars-d mailing list