April 01, 2019 Re: More complexity creep in Phobos | ||||
---|---|---|---|---|
| ||||
Posted in reply to Olivier FAURE | On 4/1/19 2:13 PM, Olivier FAURE wrote:
> tl;dr Keep strings and reference-counting separate.
You can't do that. New strings are created frequently by concatenation, they're best thought of as units - like int. They need to handle their own allocation, there's no two ways about it.
Autodecoding hurts "half" of the users - those who don't need it for the task. De-encapsulating string as an unstructured slice hurts the other "half" - those who need things like Unicode semantics, simple string manipulation, and good use of memory.
The view that strings must be char[] and that that's the "simple" choice has been a disaster for D. (I believe I have started to convince Walter of that.) It's simple like Go is simple - forcing complexity realities on users. Incomparably larger than autodecoding. It has forced virtually all string-processing code in D to use the garbage collector. Immutable was a short of adrenaline that prolonged the lifetime of strings by ten years. Before that, having unstructured strings that were also weirdly mutable was a double disaster.
We must have a UTF8 reference counted string that assists built-in literals of type immutable(char)[] and rally the entire language ecosystem around those.
|
April 01, 2019 Re: More complexity creep in Phobos | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Saturday, 30 March 2019 at 22:28:32 UTC, Andrei Alexandrescu wrote:
> The author of this post wrote me a very nice private note in lieu of an unpleasant public response to my nasty way of handling this exchange. He refrained from posting in the spirit of "write letters to people you hate, then burn them" (as the joke goes, "okay, then what do I do to the letters?")
>
> Anyhow, I wanted to apologize to Meta in the same place where the offense take place. I am sorry for the unkind tone I took to.
>
> An explanation (but in no way a justification) of this came from a friend: "The more sure you are of being right, the more insufferable you become."
I appreciate the gesture Andrei, and have the utmost respect for people who are willing to apologize.
|
May 03, 2019 Re: More complexity creep in Phobos | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Thursday, 28 March 2019 at 12:38:58 UTC, Andrei Alexandrescu wrote:
> BTW the intended title was "More generality creep in Phobos". Turns out generality creep begets complexity creep, too...
DirEntry is implicitly convertible to string because it needs to be usable with std.file, which is a big untyped ball of strings.
|
May 03, 2019 Re: More complexity creep in Phobos | ||||
---|---|---|---|---|
| ||||
Posted in reply to Olivier FAURE | On Monday, 1 April 2019 at 18:13:55 UTC, Olivier FAURE wrote:
> Why?
>
> Strings have the advantage of being extremely simple constructs that represent exactly the right abstraction: they're a slice of chars, period. They can be scoped, sliced and concatenated just like any other range.
>
Well, you see, strings have the disadvantage of being constructs that represent exactly the wrong abstraction: they're a slice of chars, period.
To see the problem with this, consider:
writefln(
"äöü are %s letters; the second one is %s",
"äöü".length,
cast(ubyte[]) "äöü"[1..2]);
|
Copyright © 1999-2021 by the D Language Foundation