The Case Against Autodecode

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 1 14:48:14 PDT 2016


On 06/01/2016 05:30 PM, Jack Stouffer wrote:
> 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.

No, this is autodecoding pure and simple. We can't move the goals 
whenever we don't like where the ball gets. The usual language rules are 
not applied for strings - they are autodecoded (i.e. there's code 
generated that magically decodes UTF surprisingly for beginners, in 
apparent violation of the language rules, and without any user-visible 
request) by the foreach statement. -- Andrei



More information about the Digitalmars-d mailing list