Thread overview
maintenance
Sep 16, 2020
James Blachly
Sep 17, 2020
Jon Degenhardt
Sep 17, 2020
bachmeier
Sep 16, 2020
Imperatorn
September 15, 2020
Looks like there's a fair amount of opportunity to improving code in phobos in ways that reduce its complexity and size, and also make it more robust without breaking backwards compatibility. I just took std.algorithm.comparison because it kinda was the first alphabetically, and there's some good red here: https://github.com/dlang/phobos/pull/7635/. Would be great if others joined!
September 15, 2020
On 9/15/20 1:38 PM, Andrei Alexandrescu wrote:
> Looks like there's a fair amount of opportunity to improving code in phobos in ways that reduce its complexity and size, and also make it more robust without breaking backwards compatibility. I just took std.algorithm.comparison because it kinda was the first alphabetically, and there's some good red here: https://github.com/dlang/phobos/pull/7635/. Would be great if others joined!

Andrei,

Thanks for doing this often thankless work. I benefit every day from your and others' work on Phobos

September 16, 2020
On Tuesday, 15 September 2020 at 17:38:09 UTC, Andrei Alexandrescu wrote:
> Looks like there's a fair amount of opportunity to improving code in phobos in ways that reduce its complexity and size, and also make it more robust without breaking backwards compatibility. I just took std.algorithm.comparison because it kinda was the first alphabetically, and there's some good red here: https://github.com/dlang/phobos/pull/7635/. Would be great if others joined!

Great initiative 👍
September 16, 2020
On 9/15/20 8:27 PM, James Blachly wrote:
> On 9/15/20 1:38 PM, Andrei Alexandrescu wrote:
>> Looks like there's a fair amount of opportunity to improving code in phobos in ways that reduce its complexity and size, and also make it more robust without breaking backwards compatibility. I just took std.algorithm.comparison because it kinda was the first alphabetically, and there's some good red here: https://github.com/dlang/phobos/pull/7635/. Would be great if others joined!
> 
> Andrei,
> 
> Thanks for doing this often thankless work. I benefit every day from your and others' work on Phobos

Actually it's quite satisfying in a relaxing kind of way. Like putting tools in order in the shop. Also it's important; I recall people recommended here that beginners look at phobos' source for how to write idiomatic D. I'd definitely want them to look at good code.

September 17, 2020
On Thursday, 17 September 2020 at 02:16:06 UTC, Andrei Alexandrescu wrote:
> Also it's important; I recall people recommended here that beginners look at phobos' source for how to write idiomatic D. I'd definitely want them to look at good code.

Very much agree with this. Examples of good D code is something I wish there was more of. Improvements to Phobos in this area are definitely worthwhile. (What I could really use right now are a few more samples using asyncBuf from std.parallelism!)

--Jon
September 17, 2020
On Thursday, 17 September 2020 at 02:16:06 UTC, Andrei Alexandrescu wrote:
> On 9/15/20 8:27 PM, James Blachly wrote:

>> Thanks for doing this often thankless work. I benefit every day from your and others' work on Phobos
>
> Actually it's quite satisfying in a relaxing kind of way. Like putting tools in order in the shop. Also it's important; I recall people recommended here that beginners look at phobos' source for how to write idiomatic D. I'd definitely want them to look at good code.

If you want to write code using ranges, reading the standard library is time well spent. Idiomatic range-based programming is not always easy.
September 17, 2020
On 9/16/20 10:16 PM, Andrei Alexandrescu wrote:
> On 9/15/20 8:27 PM, James Blachly wrote:
>> On 9/15/20 1:38 PM, Andrei Alexandrescu wrote:
>>> Looks like there's a fair amount of opportunity to improving code in phobos in ways that reduce its complexity and size, and also make it more robust without breaking backwards compatibility. I just took std.algorithm.comparison because it kinda was the first alphabetically, and there's some good red here: https://github.com/dlang/phobos/pull/7635/. Would be great if others joined!
>>
>> Andrei,
>>
>> Thanks for doing this often thankless work. I benefit every day from your and others' work on Phobos

Seconded!

> 
> Actually it's quite satisfying in a relaxing kind of way. Like putting tools in order in the shop. Also it's important; I recall people recommended here that beginners look at phobos' source for how to write idiomatic D. I'd definitely want them to look at good code.
> 

It's also instructive to see what *even the language maintainers* have to do to workaround limitations of the language.

If there are things in Phobos that look way more complex than they should be (you have a couple of good examples in your "Goofy code" thread), then it might be a signal that we can do better with the features the language provides.

As I said in my talk last year -- D's introspection and code generation capabilities are the crown jewel of D. We should do everything possible to improve the situation for those types of tasks.

-Steve
September 17, 2020
On 9/17/20 5:39 PM, Steven Schveighoffer wrote:
> As I said in my talk last year -- D's introspection and code generation capabilities are the crown jewel of D. We should do everything possible to improve the situation for those types of tasks.

Word. Actually I've had quite a bit of success with this:

private mixin template ImplementEmpty(alias member)
{
    static if (isInfinite!(typeof(member)))
    {
        // Propagate infinite-ness.
        enum bool empty = false;
    }
    else
    {
        @property bool empty()
        {
            return member.empty;
        }
    }
}

PR coming soon.