February 05

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

>

Second, this design implies that the '2' in std2. is a version specifier that would be incremented with each Phobos release. This was not the intention and we agreed that it would be confusing. I proposed using sys. as the root name for Phobos 3 and Walter found that acceptable. We briefly discussed splitting up Phobos into multiple roots and no firm agreement was reached.

And then subsequent versions get put in a package with a version number under that?

>

The other major topic of discussion was what I've been calling the "Crippled by Default" design of editions, where the oldest edition (technically the last pre-edition release) is the default edition if no edition is specified. This poses a few challenges from an end-user standpoint

Which ones?

>

, but the argument that ended up resonating was the idea that in engineering we always want to make the "right" way the default or easiest way to do something, and then provide escape hatches where necessary.

And the right way should be to not break existing code, even if they upgrade the compiler.

>

Therefore, the compiler should default to use the latest version

The latest version of Phobos? Of the language?

>

and then provide the ability via a switch to set the edition, or lack thereof, of the modules an import path.

I think this option is useful for trying to upgrade a project to a new edition, but I'm not sure how it applies here.

>

This solves the problem of abandon-ware packages being accessible

Abandon-ware Phobos packages?

>

without presenting the new user with an ever more decayed version of the compiler.

I don't understand what this means.

>

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.

It's unclear to me how we'd be doing that if the new Phobos version(s) is namespaced differently.

>

When then moved on to a conversation about how Walter envisions editions actually working. Since none of have seen the document that Atila is working on, Walter shared his opinions on how it should work. Essentially, Walter would like to see a "hybrid" approach having edition attributes for specific experimental features, and then having a yearly "roll-up" edition that includes all the promoted features from the prior year. So if DIP1000 gets promoted to Edition 2025, then DIP1000 would be active by default in that edition and all subsequent editions without having to specifically enable it.

I'm not sure every year is a good time interval.

>

I did bring up that this was likely to cause another "function attribute soup" problem

How?

>

but in general I wholeheartedly agree with the idea that editions should use this model, both C# and C++ both do something similar so it would be conceptually comfortable to users coming from those languages. Atila, if you're reading this, this is what Walter was thinking/hoping would appear,

The reason for that is because I told him that's how I was thinking of doing it ;)

>

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.

This is the part I'm really not clear about yet.

>

I think this makes sense as Phobos doesn't really have editions,

Unless it opts in to a new one. And it should, because we want to lead by example.

>

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:

  • Promoting allocators out of experimental.

This requires solving a number of thorny issues, including "does this API even make sense?", which I'm told Paul Backus is working on.

>
  • Range interface redesign (see JMD's thread here).
  • Fix std.traits.

What does "fix" mean in this context?

>

The above list is not exhaustive and we are open to further suggestions.

  • XML
  • JSON
  • YAML
  • SDL?
  • Channels
  • ...
February 05

On Saturday, 3 February 2024 at 12:53:34 UTC, Paul Backus wrote:

>

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

>

[...]

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.

I think our goal is to make -betterC obsolete. As in: if you don't use the feature, you don't pay for it, and it's implicit.

February 05

On Sunday, 4 February 2024 at 01:14:56 UTC, Adam Wilson 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

The EH problem has two potential answers.

Three: copy Herb Sutter's idea.

>

The first is the sumtype answer. That would be zero runtime cost and would achieve a similar result as the current EH scheme.

Not unless we solve the "bubbling up" issue to avoid pattern matching over and over again when none of the N functions in the call stack between main and the one "throwing" care. So far all I know of is Rust's ? and monads.

February 05

On Monday, 5 February 2024 at 14:38:56 UTC, Atila Neves wrote:

>

I think our goal is to make -betterC obsolete. As in: if you don't use the feature, you don't pay for it, and it's implicit.

Very nice.

February 05

On Monday, 5 February 2024 at 14:38:56 UTC, Atila Neves wrote:

>

On Saturday, 3 February 2024 at 12:53:34 UTC, Paul Backus wrote:

>

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.

I think our goal is to make -betterC obsolete. As in: if you don't use the feature, you don't pay for it, and it's implicit.

This is more of a goal for druntime than Phobos, but yes, agreed.

Even in the 100% pay-as-you-go world, I think we'll still want Phobos APIs to avoid depending on (and paying for) more druntime features than they really need to.

February 05

On Monday, 5 February 2024 at 15:40:11 UTC, Paul Backus wrote:

>

On Monday, 5 February 2024 at 14:38:56 UTC, Atila Neves wrote:

>

On Saturday, 3 February 2024 at 12:53:34 UTC, Paul Backus wrote:

>

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.

I think our goal is to make -betterC obsolete. As in: if you don't use the feature, you don't pay for it, and it's implicit.

This is more of a goal for druntime than Phobos, but yes, agreed.

Even in the 100% pay-as-you-go world, I think we'll still want Phobos APIs to avoid depending on (and paying for) more druntime features than they really need to.

Yeah, that's a good point. For instance: not allocating for no reason, and leaving it up to the user instead. If they want to call .array on the result, that's up to them. Preferring "sink" toString implementations, that kind of thing.

February 05
On Mon, Feb 05, 2024 at 02:38:56PM +0000, Atila Neves via Digitalmars-d wrote: [...]
> I think our goal is to make `-betterC` obsolete. As in: if you don't use the feature, you don't pay for it, and it's implicit.

+1, this is the right approach.


T

-- 
It said to install Windows 2000 or better, so I installed Linux instead.
February 06
On 06/02/2024 3:41 AM, Atila Neves wrote:
>     The EH problem has two potential answers.
> 
> Three: copy Herb Sutter's idea.
> 

Oh look, someone has already done it!

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

On Monday, 5 February 2024 at 15:40:11 UTC, Paul Backus wrote:

> >

I think our goal is to make -betterC obsolete. As in: if you don't use the feature, you don't pay for it, and it's implicit.

Even in the 100% pay-as-you-go world, I think we'll still want Phobos APIs to avoid depending on (and paying for) more druntime features than they really need to.

This feels delusional to me; like I don't know how the formal style with its contracts and extra asserts and 5 layered datetime will ever avoid rogue imports that aren't part of a blessed compile environment.

I have a wasm build script, feel free to test if any single function of any of the std can compile with libc.math imports t_time which isnt found with the broken wasm enverment.

The current style leads to highly incestuous, overly reliant on long correct versions of code that just leads to a highly connected graph. I see no suggesting from any "pay-as-you-go std" advocate that isn't "we wil be more careful", "we will compile with more @nogc" when I dont even know if it would work but a solution id see would need to make local imports only be allowed in templated code(so it actually functioned as pay as you go), drastically cutting back on complexity(no 500 line nullable and 100 line template contracts)

February 05

On Monday, 5 February 2024 at 16:36:02 UTC, monkyyy wrote:

>

On Monday, 5 February 2024 at 15:40:11 UTC, Paul Backus wrote:

> >

I think our goal is to make -betterC obsolete. As in: if you don't use the feature, you don't pay for it, and it's implicit.

Even in the 100% pay-as-you-go world, I think we'll still want Phobos APIs to avoid depending on (and paying for) more druntime features than they really need to.

This feels delusional to me; like I don't know how the formal style with its contracts and extra asserts and 5 layered datetime will ever avoid rogue imports that aren't part of a blessed compile environment.

The way you avoid this stuff is by testing. Run your unit tests with -betterC and any accidental druntime dependencies you add will be revealed to you very quickly.

The current version of Phobos was written before BetterC existed and is kind of lazy about testing in general, so it doesn't do this, but I'm hoping that will change with Phobos V3.

I've tried to set an example with std.sumtype. Unlike every other module in Phobos, its unit tests are enabled in BetterC by default, and those that depend on druntime have to make this explicit by using a version condition.