DIP76: Autodecode Should Not Throw

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 7 11:16:16 PDT 2015


On Tue, Apr 07, 2015 at 06:00:12PM +0000, w0rp via Digitalmars-d wrote:
> 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.

If somebody were to write a DIP for killing autodecoding, I'd vote in
favor.

Getting it past Andrei, OTOH, is a different story. ;-)


T

-- 
Never trust an operating system you don't have source for! -- Martin Schulze


More information about the Digitalmars-d mailing list