February 02

On Friday, 2 February 2024 at 09:09:37 UTC, Adam Wilson wrote:

>

First, it would be very easy to accidentally type std. in an std2. module. We realized that this would be a problem no matter what root name was used and that the appropriate answer would be to specify a DStyle rule specific to Phobos that only modules in std. can import std. modules.

What about std.v1., std.v2. and so on? And obviously std.v1.* == std.*

>

Therefore, the compiler should default to use the latest version and then provide the ability via a switch to set the edition, or lack thereof, of the modules an import path. This solves the problem of abandon-ware packages being accessible without presenting the new user with an ever more decayed version of the compiler. We want to put out best foot forward and presenting the last pre-editions release, which is constantly getting old as time passes, does not do that. No specific agreement was reached but Walter agreed to consider it.

Is the newest compiler compatible with oldest phobos?
Maybe some sort of automagical import std.old.v108;

>

After that we had a discussion about how to distribute Phobos. This mostly centered on what release cadence to use. I argued for linking the Phobos version to the edition release schedule. I think this is sensible and makes it easier for people to reason about which compiler/library pairing they are using. Walter was fine with that, but he does not want to use the "Edition" language to describe Phobos releases. I think this makes sense as Phobos doesn't really have editions, but following SemVer, it would have yearly major releases. This would mean that new features are released once per year, and bugfixes would be released on whatever the fast-cadence schedule is for DMD in between Yearly Edition roll-ups.

Can phobos and dmd split themselves, just like any other library, or are we supposed to keep them together?

>

Finally, we touched briefly on the major changes we would like to see in Phobos 3 and these are the major changes we are committing to for Phobos 3 so far:

  • Removal of Autodecoding.

+1

>
  • Promoting allocators out of experimental.

+1

>
  • Range interface redesign

+1

>
  • Fix std.traits.

+1

  • Removing ext dependencies could make things easier (f.e. libcurl) for multi-platform development (it's nice to statically compile everything in a single executable, but it's not that easy: I did it for https://github.com/trikko/tshare)
  • Phobos with webassembly
  • Phobos with betterC

Andrea

February 02

On Friday, 2 February 2024 at 09:09:37 UTC, Adam Wilson wrote:

>

Walter and I had a productive conversation yesterday about Phobos 3 and we felt it would be appropriate to share some notes on our discussion.

[...]

Will there be a plan to put Phobos 2 on life support and eventually sunset it? It doesn't make sense to support that forever.

February 02

On Friday, 2 February 2024 at 19:39:34 UTC, Lance Bachmeier wrote:

>

A sufficient reason is that I know how things get done around here, and an updated Phobos with these additions will optimistically be released in 2032. Most of the work has already been done. Why not reuse it?

If I'm not mistaken Go has this for over 10 years now. I'm not aware of any other language/ecosystem that followed this.

February 03

On Friday, 2 February 2024 at 19:39:34 UTC, Lance Bachmeier wrote:

>

On Friday, 2 February 2024 at 18:57:48 UTC, Adam Wilson wrote:

>

I cannot argue strenuously enough against putting the packaging system in to the compiler directly. Not only will it balloon the build times by orders of magnitude, it is a serious violation of separation-of-concerns. The compiler should concern itself with compiling code and nothing else. The compiler is the wrong place to be handling third-party packages, that is properly the venue of the build system.

I responded to the other comment, but I'll give the same answer. What I'm proposing doesn't have anything to do with the packaging system, Dub, or any of that. The only thing the compiler would have to know is how to download the source files of a package if they haven't already been downloaded.

But that's not true is it? How does it know which versions of the package are acceptable? Which of the acceptable versions does it pull? How does it handle the packages' dependencies? You simply cannot have the compiler pull a package without going through the entire dependency resolution process. Which means you're building DUB into DMD. Compilers are not package managers. I've asked Walter about this idea before and the reception was ... not positive, so probably best to just drop it.

> >

People always say there are good reasons, but are light on actual reasons. Saying that Phobos has a high bar is not itself a reason so much as an excuse to not make the effort.

A sufficient reason is that I know how things get done around here, and an updated Phobos with these additions will optimistically be released in 2032. Most of the work has already been done. Why not reuse it?

That's not a reason. You're saying that you know what the reason is, that you're not going to state the reason, but that your special knowledge is so perfect that you can confidently state a ridiculous timeline as fact? I would suggest that you might want to consider how superlatively arrogant that sounds. DConf 2024 is probably a stretch, but sometime in 2025 is probably realistic, unless the money floodgates open and time can be purchased, but I'm not holding my breath for that outcome.

>

It's been eight months since I proposed a simple solution to the problem that library writers have to support too many compiler releases. Label some compiler releases as not being supported by library writers. It would have solved the problem fully and it could have been done by the end of the day. Obviously we couldn't do that. Instead we got editions. Eight months later, we still don't have an initial proposal, and the problem for library writers continues.

That is pretty much where this is going to end. Walter and I discussed tying Phobos releases to Compiler Editions, and he was amenable to the idea, his only sticking point was to not use "Editions" to describe Phobos, and "Versions" or "Releases" works just fine for our purposes. I would expect to see Phobos 3 land with the first Edition. Both of which I would expect in 2025.

I am sorry to hear that it's not getting there as fast as you want it to, but that is the nature of volunteer projects, so unless you're willing to step up and help out, it's going to happen at pretty much whatever pace the rest of us can afford. But don't expect much sympathy when you're whining about a problem you're not doing anything to help solve.

> >

Under my watch (if the community doesn't kick me out) Phobos will move faster. And yes, there might even be more bugs that escape. My plan is to use the monthly(Atila?) releases between the major roll-up releases mentioned in my original post to catch them before they get to the wider population.

I hope that's true. It's hard to change the culture of any organization, especially one built on volunteer labor.

Yes and no, so long as the primary volunteers working on a specific piece stay the same then yes, expect similar results. But change out the personnel and I would expect the results to change. This is also true in a for-profit corp, but to a lesser degree, as volunteers are usually far less restricted by onerous policies.

If I run Phobos development, I will run it differently. Walter has asked that I not go crazy, but so far everything I've talked about has been met with some variant of "that's ... different" so skepticism yes, but so far Walter and the DLF have been willing to extend me that latitude.

February 03

On Friday, 2 February 2024 at 21:11:51 UTC, Andrea Fontana wrote:

>

On Friday, 2 February 2024 at 09:09:37 UTC, Adam Wilson wrote:

>

First, it would be very easy to accidentally type std. in an std2. module. We realized that this would be a problem no matter what root name was used and that the appropriate answer would be to specify a DStyle rule specific to Phobos that only modules in std. can import std. modules.

What about std.v1., std.v2. and so on? And obviously std.v1.* == std.*

>

Therefore, the compiler should default to use the latest version and then provide the ability via a switch to set the edition, or lack thereof, of the modules an import path. This solves the problem of abandon-ware packages being accessible without presenting the new user with an ever more decayed version of the compiler. We want to put out best foot forward and presenting the last pre-editions release, which is constantly getting old as time passes, does not do that. No specific agreement was reached but Walter agreed to consider it.

Is the newest compiler compatible with oldest phobos?
Maybe some sort of automagical import std.old.v108;

This hasn't been fully decided yet, and I probably need to have a chat with Atila so we can sort out some of the practical issues. But what I am pushing for is tying Phobos versions to matching editions. Example: Phobos 3 == Edition 2025 (2024?), Phobos 4 == Edition 2026, etc. The plan as I understand it is that Phobos 3 code can be built with later editions. So the "Edition 2025" is a minimum supported edition level.

> >

After that we had a discussion about how to distribute Phobos. This mostly centered on what release cadence to use. I argued for linking the Phobos version to the edition release schedule. I think this is sensible and makes it easier for people to reason about which compiler/library pairing they are using. Walter was fine with that, but he does not want to use the "Edition" language to describe Phobos releases. I think this makes sense as Phobos doesn't really have editions, but following SemVer, it would have yearly major releases. This would mean that new features are released once per year, and bugfixes would be released on whatever the fast-cadence schedule is for DMD in between Yearly Edition roll-ups.

Can phobos and dmd split themselves, just like any other library, or are we supposed to keep them together?

I've heard rumors about going mono-repo. But for the moment they are in separate repos, and the initial Phobos 3 development will likely be done in a separate repo to avoid waiting on and conflicting with the primary development path. After that I would expect it to land in the same repo as Phobos 2.

> >

Finally, we touched briefly on the major changes we would like to see in Phobos 3 and these are the major changes we are committing to for Phobos 3 so far:

  • Removal of Autodecoding.

+1

>
  • Promoting allocators out of experimental.

+1

>
  • Range interface redesign

+1

>
  • Fix std.traits.

+1

  • Removing ext dependencies could make things easier (f.e. libcurl) for multi-platform development (it's nice to statically compile everything in a single executable, but it's not that easy: I did it for https://github.com/trikko/tshare)

Easier said that done, because the one thing you cannot do without an external library is cryptography, and if the advice is to just use OpenSSL, we would be better served telling them to skip that entirely and just check themselves into a mental institution directly (I implemented crypto using OpenSSL, AMA).

Specific to libcurl I think we should use the built-in sockets, but this requires a bunch of work from JMD, who is also heading up ranges. We have a lot of work and few people to help, so we have to be judicious here, and C libraries via ImportC offer an appealing amount of leverage.

>
  • Phobos with webassembly

This is mostly a DMD/DRT problem. The big hang-up with WASM has been that WASM only recently got GC support and the current compiler integrations haven't been updated to support, it you want to help out with that, look for a call for volunteers from Mike Parker some time in the near future. WASM is pretty high up the priority list.

>
  • Phobos with betterC

This is not in the cards. BetterC would seriously constrain the capability of Phobos as we expect to support TypeInfo/ModuleInfo, threading, Dynamic/Associative arrays, and static module constructors/destructors.

>

Andrea

February 03

On Saturday, 3 February 2024 at 03:49:54 UTC, Adam Wilson wrote:

> >
  • Phobos with betterC

This is not in the cards. BetterC would seriously constrain the capability of Phobos as we expect to support TypeInfo/ModuleInfo, threading, Dynamic/Associative arrays, and static module constructors/destructors.

>

Andrea

What typeinfo/moduleinfo has to do with a networking module in the STD for example?

Dynamic array/associative array can be made to work with -betterC, i mentioned in my reply above, minimal allocator API in core.memory make associative array able to change its allocator, and build APIs in phobos around allocators and people who use betterC will be able to consume phobos without people working on phobos having to know/care about betterC

If you care about simplicity and efficiency, obviously

February 03

On Saturday, 3 February 2024 at 11:53:05 UTC, ryuukk_ wrote:

>

On Saturday, 3 February 2024 at 03:49:54 UTC, Adam Wilson wrote:

> >
  • Phobos with betterC

This is not in the cards. BetterC would seriously constrain the capability of Phobos as we expect to support TypeInfo/ModuleInfo, threading, Dynamic/Associative arrays, and static module constructors/destructors.

>

Andrea

What typeinfo/moduleinfo has to do with a networking module in the STD for example?

Dynamic array/associative array can be made to work with -betterC, i mentioned in my reply above, minimal allocator API in core.memory make associative array able to change its allocator, and build APIs in phobos around allocators and people who use betterC will be able to consume phobos without people working on phobos having to know/care about betterC

If you care about simplicity and efficiency, obviously

Oh, and Exception Handling?

Get in native tuple and tagged union in the language, and you'll be able to build nice error handling code

I hope no EH in Phobos 3

February 03

On Saturday, 3 February 2024 at 11:54:48 UTC, ryuukk_ wrote:

>

Oh, and Exception Handling?

Get in native tuple and tagged union in the language, and you'll be able to build nice error handling code

I hope no EH in Phobos 3

Existing try catch syntax could be improved to support tagged union you've mentioned btw. Compiler then would inject extra code on each statement that returns a tagged union to automatically forward to appropriate catch clause, if an exception is returned from said statement.

February 04
On 04/02/2024 1:40 AM, Alexandru Ermicioi wrote:
> On Saturday, 3 February 2024 at 11:54:48 UTC, ryuukk_ wrote:
>>
>> Oh, and Exception Handling?
>>
>> Get in native tuple and tagged union in the language, and you'll be able to build nice error handling code
>>
>> I hope no EH in Phobos 3
> 
> Existing try catch syntax could be improved to support tagged union you've mentioned btw.  Compiler then would inject extra code on each statement that returns a tagged union to automatically forward to appropriate catch clause, if an exception is returned from said statement.

Yes it is well known that we want a different exception handling implementation in addition to the runtime one we have now.

I suspect I should probably begin doing a write up on sum types. I'm not happy with Walter's design. It leaves some things out that are kinda needed to match the problem domain.

https://github.com/rikkimax/DIPs/blob/value_type_exceptions/DIPs/DIP1xxx-RC.md
February 03

On Saturday, 3 February 2024 at 03:49:54 UTC, Adam Wilson wrote:

>

On Friday, 2 February 2024 at 21:11:51 UTC, Andrea Fontana wrote:

>
  • Phobos with betterC

This is not in the cards. BetterC would seriously constrain the capability of Phobos as we expect to support TypeInfo/ModuleInfo, threading, Dynamic/Associative arrays, and static module constructors/destructors.

Obviously we are not going to get all of Phobos to work with BetterC, but significant chunks of it already do, and there's a good deal more that could be considered low-hanging fruit.

I think the right approach here is to try to make code BetterC-compatible when we can, and to at least keep BetterC compatibility in mind as a "nice-to-have" goal (but not a requirement) when doing API design. For example, if the only thing keeping a function from being BetterC-compatible is that it uses the GC to allocate memory for an error message, it's probably worth a little bit of extra effort to either get rid of that GC dependency, or provide a version (D_BetterC) alternative.