The Case Against Autodecode

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri May 13 11:18:58 PDT 2016


On Fri, May 13, 2016 at 12:16:30PM +0000, Nick Treleaven via Digitalmars-d wrote:
> On Friday, 13 May 2016 at 00:47:04 UTC, Jack Stouffer wrote:
> >If you're serious about removing auto-decoding, which I think you and
> >others have shown has merits, you have to the THE SIMPLEST migration
> >path ever, or you will kill D. I'm talking a simple press of a
> >button.
> 
> char[] is always going to be unsafe for UTF-8. I don't think we can
> remove it or auto-decoding, only discourage use of it. We need a
> String struct IMO, without length or indexing. Its front can do
> autodecoding, and it has a ubyte[] raw() property too. (Possibly the
> byte length of front can be cached for use in popFront, assuming it
> was faster). This would be a gradual transition.

alias String = typeof(std.uni.byGrapheme(immutable(char)[].init));

:-)

Well, OK, perhaps you could wrap this in a struct that allows extraction
of .raw, etc.. But basically this isn't hard to implement today. We
already have all of the tools necessary.


T

-- 
Dogs have owners ... cats have staff. -- Krista Casada


More information about the Digitalmars-d mailing list