DIP76: Autodecode Should Not Throw

w0rp via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 7 11:00:12 PDT 2015


On Tuesday, 7 April 2015 at 09:21:52 UTC, Walter Bright wrote:
> On 4/7/2015 2:10 AM, Vladimir Panteleev wrote:
>> I think the correct solution to that is to kill auto-decoding 
>> :) Then all
>> decoding is explicit, and since it is explicit, it is trivial 
>> to allow
>> specifying the desired behavior upon encountering invalid 
>> UTF-8.
>
> I agree autodecoding is a mistake, but we're stuck with it.

I don't think we are stuck with it. I think we can change it. I 
think a lot of the automatic decoding happens inside of Phobos, 
while people care mostly about the boundaries of the API. If we 
do get rid of it, then as Vladimir says, you can opt in to 
whether or not you want a non-throwing conversion, or a throwing 
one.

I was going to write about how the auto decoding doesn't solve 
the problem of comparing strings, given that you need to look at 
ranges of characters, subject to normalisation, unless you're 
dealing with just ASCII. I think all of that has been said to 
death, though. I think it's possible for us to get rid of 
automatic decoding.


More information about the Digitalmars-d mailing list