Major performance problem with std.array.front()

Vladimir Panteleev vladimir at thecybershadow.net
Fri Mar 7 08:18:04 PST 2014


On Friday, 7 March 2014 at 15:03:24 UTC, Dicebot wrote:
> I don't like it at all.
>
> 1) It is a huge breakage

Can we look at some example situations that this will break?

> and you have been refusing to do one even for more important 
> problems.

This is a fallacy.

> 2) It is regression back to C++ days of 
> no-one-cares-about-Unicode pain. Thinking about strings as 
> character arrays is so natural and convenient that if 
> language/Phobos won't punish you for that, it will be extremely 
> widespread.

Thinking about dstrings as character arrays is less flawed only 
to a certain extent.

> Now real problems I see:
>
> 1) stuff like readText() returns char[] instead of requiring 
> explicit default encoding
>
> 2) lack of convenient .raw property which will effectively do 
> cast(ubyte[])
>
> 3) the fact that std.string always assumes unicode and never 
> forwards to std.ascii for 
> http://dlang.org/phobos/std_encoding.html#.AsciiString / ubyte[]

I think these are fixable without breaking anything? So why not 
go for it? The first two sound trivial (.raw can be an UFCS 
property).


More information about the Digitalmars-d mailing list