The Case Against Autodecode

Bill Hicks via Digitalmars-d digitalmars-d at puremagic.com
Thu May 12 23:50:49 PDT 2016


On Thursday, 12 May 2016 at 20:15:45 UTC, Walter Bright wrote:
>
> Here are some that are not matters of opinion.
>
> 1. Ranges of characters do not autodecode, but arrays of 
> characters do. This is a glaring inconsistency.
>
> 2. Every time one wants an algorithm to work with both strings 
> and ranges, you wind up special casing the strings to defeat 
> the autodecoding, or to decode the ranges. Having to constantly 
> special case it makes for more special cases when plugging 
> together components. These issues often escape detection when 
> unittesting because it is convenient to unittest only with 
> arrays.
>
> 3. Wrapping an array in a struct with an alias this to an array 
> turns off autodecoding, another special case.
>
> 4. Autodecoding is slow and has no place in high speed string 
> processing.
>
> 5. Very few algorithms require decoding.
>
> 6. Autodecoding has two choices when encountering invalid code 
> units - throw or produce an error dchar. Currently, it throws, 
> meaning no algorithms using autodecode can be made nothrow.
>
> 7. Autodecode cannot be used with unicode path/filenames, 
> because it is legal (at least on Linux) to have invalid UTF-8 
> as filenames. It turns out in the wild that pure Unicode is not 
> universal - there's lots of dirty Unicode that should remain 
> unmolested, and autocode does not play with that.
>
> 8. In my work with UTF-8 streams, dealing with autodecode has 
> caused me considerably extra work every time. A convenient 
> timesaver it ain't.
>
> 9. Autodecode cannot be turned off, i.e. it isn't practical to 
> avoid importing std.array one way or another, and then 
> autodecode is there.
>
> 10. Autodecoded arrays cannot be RandomAccessRanges, losing a 
> key benefit of being arrays in the first place.
>
> 11. Indexing an array produces different results than 
> autodecoding, another glaring special case.

Wow, that's eleven things wrong with just one tiny element of D, 
with the potential to cause problems, whether fixed or not.  And 
I get called a troll and other names when I list half a dozen 
things wrong with D, my posts get removed/censored, etc, all 
because I try to inform people not to waste time with D because 
it's a broken and failed language.

*sigh*

Phobos, a piece of useless rock orbiting a dead planet ... the 
irony.


More information about the Digitalmars-d mailing list