June 04
Atila Neves kirjoitti 3.6.2024 klo 19.05:
>> - How would a library expose different interfaces to importers that use different editions? (This may be required because different editions allow different interface designs and guarantees, or have a different user-accessible druntime interface and e.g. druntime types are in the library API.)
> 
> Good question. I guess we'll need some kind of `version(Edition2024)`.

This doesn't work, except for mixins. A version block will be turned on or off based on edition of the library, not of the client - or at least that's what I'd expect.

See my idea about `__EDITION__` special token earlier in this thread for an alternative.

June 06

On Monday, 3 June 2024 at 02:36:08 UTC, Steven Schveighoffer wrote:
...[snip]

>

-Steve

It was not my intent to hijack this thread, so I've started a new one in general here: https://forum.dlang.org/post/zljtammlddzxjmpfzqsv@forum.dlang.org

I hope it addresses some of what you mention.

June 06

On Thursday, 30 May 2024 at 18:31:48 UTC, Atila Neves wrote:

>

https://github.com/atilaneves/DIPs/blob/editions/editions.md

Destroy!

I hope you will tolerate this unsolicited intrusion of mine, but as an outsider to your world, I feel the need to say something.

Not long ago, I approached this language because, after examining its fundamentals, I judged it to be the perfect evolution of "my" C language. A few days later, I changed my mind, not because I was wrong in judging the D language, but because D is unusable. And it is unusable because you do everything to make it so.

Let me explain: the primary requirement for a programming language is not its flexibility, power, ease of learning, etc. No, the primary requirement is its stability and the certainty that code written for a release will be compiled by all compilers and libraries that support it.

And this is what makes D unusable (and indeed practically unused). As soon as it is born, a fork of its system library... as soon as it starts to receive support from major IDEs, a fork of the language. Now I see your willingness to make it "dynamically scalable"... my friends, this way, you're going nowhere.

Let's talk about the initiative related to this thread: it doesn't work. It's not acceptable that using the same language, I would write code that wouldn't be compiled by the machine of the programmer at the desk next to mine. This would be possible if I were programming in C and he in D, but if we both work in Dv2, the language standard must be the same for everyone.

Of course, there can be a Dv3, Dv4... Dv2001, but someone has to standardize each version and, once done, there must be a freeze that prevents changes (except for debugging).

Maybe I am too conservative for a lively language like this, it happens to us sixty-year-olds. But being sixty has an advantage: we know the business world well. From experience, I would find it very difficult to convince a company to use code written in D. Companies are more conservative than sixty-year-olds and do not like investments that change from one day to the next. Asking a programmer what version of D they work with is inconvenient, it is much more practical not to accept D.

Now I retreat, apologizing for the inconvenience caused.

Regards, U.

June 06
On 6/3/24 18:05, Atila Neves wrote:
> On Saturday, 1 June 2024 at 21:14:38 UTC, Timon Gehr wrote:
>> On 5/30/24 20:31, Atila Neves wrote:
>>> https://github.com/atilaneves/DIPs/blob/editions/editions.md
>>>
>>> Destroy
>> - How do you compile different modules with different editions on the same command line?
> 
> If they all have module declarations, it's handled there, otherwise I hadn't thought of that. Do you think that will be common? I'm not sure it will be.
> ...

A lot of code will be written against the default edition and then abandoned at some point.

>> - How would a library expose different interfaces to importers that use different editions? (This may be required because different editions allow different interface designs and guarantees, or have a different user-accessible druntime interface and e.g. druntime types are in the library API.)
> 
> Good question. I guess we'll need some kind of `version(Edition2024)`.
> ...

Something like that, but `version` only includes one of the symbols, while here we would need to compile all of them.


>> - How does a newer edition with less `@safe` bugs treat `@safe` code from an older edition that has more memory safety holes?
> 
> I think I'd need a concrete example.
> ...

E.g., there are bugs that allow you to mutate through `const` pointers. Some of them may not be fixed in edition 2024 because the fix would break code. However, in edition 2025 the bugs are fixed. Now edition 2025 calls into a function from edition 2024 that violates memory safety by modifying a const pointer. All involved code is `@safe`, yet memory safety is violated and this hole can never be fixed if edition 2025 can just call into edition 2024.


>> - How do function interfaces work when some type annotations exist in only either the language edition of the caller or the language edition of the callee? E.g. think DIP1000 is in one edition but not in another.
> 
> The semantics of the edition of the callee apply.
> 
> 

This might not work because annotations in a parameter list may require caller-side guarantees in order to be checked.

June 06
On 6/6/24 06:21, Federico wrote:
> 
> Let's talk about the initiative related to this thread: it doesn't work. It's not acceptable that using the same language, I would write code that wouldn't be compiled by the machine of the programmer at the desk next to mine.

Use the same compiler and it will work. With editions, even using a newer compiler, you will still be able to compile older code. That is part of the value proposition here.

> This would be possible if I were programming in C and he in D, but if we both work in Dv2, the language standard must be the same for everyone.
> ...

There is no single language standard. And even in C and C++, the language standards are often not formal enough about all details, so in the end it's still about consensus of compiler implementations. Those compilers also have switches to enable different language behaviors.

> Of course, there can be a Dv3, Dv4... Dv2001, but someone has to standardize each version and, once done, there must be a freeze that prevents changes (except for debugging).
> ...

That is exactly what this DIP is proposing. I do not understand your objection. Even more: It proposes that different standard "immutable" versions remain compatible.

> Maybe I am too conservative for a lively language like this, it happens to us sixty-year-olds. But being sixty has an advantage: we know the business world well. From experience, I would find it very difficult to convince a company to use code written in D. Companies are more conservative than sixty-year-olds and do not like investments that change from one day to the next. Asking a programmer what version of D they work with is inconvenient,

You no longer have to ask with this proposal. That is the point.

> it is much more practical not to accept D.
> ...

Well, D users have always been a self-selected group and it has had advantages, also for the businesses that did choose to engage with D.

> Now I retreat, apologizing for the inconvenience caused.

Well it seems you misunderstood what this proposal is about. It's actually more conservative than the status quo.
June 06
On 6/2/24 02:39, Steven Schveighoffer wrote:
> I'm not the author of the proposal, but I have thoughts on how to answer these questions.
> 
> On Saturday, 1 June 2024 at 21:14:38 UTC, Timon Gehr wrote:
>> On 5/30/24 20:31, Atila Neves wrote:
>>> https://github.com/atilaneves/DIPs/blob/editions/editions.md
>>>
>>> Destroy
>> - How do you compile different modules with different editions on the same command line?
> 
> You can attribute a module with the edition you are using to build.

The whole point is not having to edit modules that were written by someone else just to be able to import them.

> I don't know that it makes a whole lot of sense to cater to a case where you are building multiple modules with different editions by specifying command line parameters.
> ...

Editions are a module-level concept, and the default edition changes over time. To me it does not even seem like a serious idea to not enable a module-specific setting to be specified per module. We would have a -mv switch to virtually change the compiler-visible file paths of individual modules, but not a way to set their edition?

> Other than that, there is separate compilation (which is supported via the `-E` switch).
> ...

Exactly, a really weird UX inconsistency. We can directly import and build C code along D code, but somehow other D code is not afforded that privilege?

>>
>> - How would a library expose different interfaces to importers that use different editions? (This may be required because different editions allow different interface designs and guarantees, or have a different user-accessible druntime interface and e.g. druntime types are in the library API.)
> 
> This could be via separate modules. I would anticipate the need for this to be so rare that catering to this case is also not worth the effort.
> ...

I wouldn't.

>>
>> - How does a newer edition with less `@safe` bugs treat `@safe` code from an older edition that has more memory safety holes?
> 
> A good question. I would approach it from the sense that calling a function must be safe for both sides.
> 
> So if you called a function with different safety rules, and those rules reduce or compromise the safety of either the caller or the callee, it would have to be a trusted call.
> 
> Note that in terms of `@safe` *bugs* and not `@safe` *design*, one would assume the safety bugs will be fixed in the newer compiler.
> ...

So old editions will keep breaking? There are currently safety bugs that are not being fixed specifically to avoid breakage.

>>
>> - How do function interfaces work when some type annotations exist in only either the language edition of the caller or the language edition of the callee? E.g. think DIP1000 is in one edition but not in another.
> 
> The type annotations are defined by the language edition for the imported module. So those would be in effect.
> 
> In other words, this is not like today where you compile one module with dip1000 and another module without, and the compiler blindly assumes all are compiled the same way.
> 
> This does introduce an interesting wrinkle -- if there are differences, newer editions *must define* the interactions like this between editions as part of the release.
> 
> -Steve

Should be in the DIP.

June 07

On Thursday, 6 June 2024 at 04:21:23 UTC, Federico wrote:

>

On Thursday, 30 May 2024 at 18:31:48 UTC, Atila Neves wrote:

>

https://github.com/atilaneves/DIPs/blob/editions/editions.md

Destroy!

I hope you will tolerate this unsolicited intrusion of mine,

There's a "Destroy!" right there, so I can't see how the "intrusion" would have been unsolicited. ;)

>

Let me explain: the primary requirement for a programming language is not its flexibility, power, ease of learning, etc. No, the primary requirement is its stability and the certainty that code written for a release will be compiled by all compilers and libraries that support it.

I agree that should be a goal.

>

And this is what makes D unusable (and indeed practically unused).

What makes you think that? Especially since in a world where those things are true I wouldn't have my current job(s).

As soon as it is born, a fork of its system library...

>

as soon as it starts to receive support from major IDEs, a fork of the language. Now I see your willingness to make it "dynamically scalable"... my friends, this way, you're going nowhere.

Let's talk about the initiative related to this thread: it doesn't work.
It's not acceptable that using the same language, I would write code that wouldn't be compiled by the machine of the programmer at the desk next to mine. This would be possible if I were programming in C and he in D, but if we both work in Dv2, the language standard must be the same for everyone.

I agree. What in the proposal makes you think that it wouldn't work?

>

Of course, there can be a Dv3, Dv4... Dv2001, but someone has to standardize each version and, once done, there must be a freeze that prevents changes (except for debugging).

Those would be editions.

>

From experience, I would find it very difficult to convince a company to use code written in D.

I would also find it difficult to convince most companies to use Haskell or Clojure, but I'm not sure how that's relevant.

June 07

On Friday, 7 June 2024 at 00:53:51 UTC, Atila Neves wrote:

>

On Thursday, 6 June 2024 at 04:21:23 UTC, Federico wrote:

>

On Thursday, 30 May 2024 at 18:31:48 UTC, Atila Neves wrote:

>

https://github.com/atilaneves/DIPs/blob/editions/editions.md

Destroy!

I hope you will tolerate this unsolicited intrusion of mine,

There's a "Destroy!" right there, so I can't see how the "intrusion" would have been unsolicited. ;)

>

Let me explain: the primary requirement for a programming language is not its flexibility, power, ease of learning, etc. No, the primary requirement is its stability and the certainty that code written for a release will be compiled by all compilers and libraries that support it.

I agree that should be a goal.

>

And this is what makes D unusable (and indeed practically unused).

What makes you think that? Especially since in a world where those things are true I wouldn't have my current job(s).

As soon as it is born, a fork of its system library...

>

as soon as it starts to receive support from major IDEs, a fork of the language. Now I see your willingness to make it "dynamically scalable"... my friends, this way, you're going nowhere.

Let's talk about the initiative related to this thread: it doesn't work.
It's not acceptable that using the same language, I would write code that wouldn't be compiled by the machine of the programmer at the desk next to mine. This would be possible if I were programming in C and he in D, but if we both work in Dv2, the language standard must be the same for everyone.

I agree. What in the proposal makes you think that it wouldn't work?

>

Of course, there can be a Dv3, Dv4... Dv2001, but someone has to standardize each version and, once done, there must be a freeze that prevents changes (except for debugging).

Those would be editions.

>

From experience, I would find it very difficult to convince a company to use code written in D.

I would also find it difficult to convince most companies to use Haskell or Clojure, but I'm not sure how that's relevant.

Unsolicited because, having abandoned the study of this language, I am not part of the community. Abandoned with great regret, I must add.

I am a very concrete person, Atila, so I judge things by results and not by potential, or at least I do so when enough time has passed to say that a final assessment can be made.
Now, should D have achieved significant penetration, at least in terms of potential? Absolutely yes, as I have already said, this language represents the natural evolution of C and is suitable for any field.
Of course, there are some incomprehensible choices, but no one is forced to use those features. The "core" of the language is what any C programmer would want to have in their hands... Bright did an extraordinary job!
And yet it did not happen. The penetration of D is modest to say the least, despite being the ideal candidate for the migration of C programmers seeking a more modern environment without significantly sacrificing efficiency already two decades ago, this affirmation did not happen.
It is correct to say that D has underperformed its potential.
And we must not think that we C programmers did not desire an evolution of the tool. Many switched to C++ (not me because I find it inelegant and very inefficient) and more recently to Rust, in this case deservedly.
And here begins D's problem: D is superior to C++, it is more elegant, more efficient, and its implementation of the object-oriented paradigm is more "natural" than what we can find in C++. And yet there was almost no migration from C/C++ to D! Why? The first serious blow came with the Phobos-Tango affair. Incomprehensible!
No one likes everything about the official libraries of C, just as I imagine is the case with any other language, but for this reason, no one wakes up tomorrow morning and creates a fork. What happens is the addition of other libraries while leaving the official ones unchanged.
There is no "stdlib_v2" that implements functions with syntax and semantics different from the standard stdlib.h.
Let's come to the present day.
D finally acquires support from the professional development environment for Microsoft, which is not Visual Studio Code but Visual Studio Pro/Enterprise, the plugin for the other professional programming environment on Linux, the Jetbrains IDEs, starts to work... and what does your community do? A nice fork of the language! Instead of writing E, which would be rational, they start developing modifications to the main language. And that's not all, because the maintainer of the Jetbrains plugin declares on GitHub that he wants to follow OpenD. So we will have a D language for Windows and a D language for Linux. Fantastic, ideal for protecting software investments!
At that point, I, a novice language student, come here to the official forum to try to understand what is happening, and I find this magnificent thread discussing the dynamic scalability of the language.
The only possible reaction: put D aside, albeit with much regret.
Why this would not work I have explained: if you want to safeguard investments, there cannot be "dynamic evolution." The correct (and accepted by companies) way to evolve a language is to convene a conference at intervals of 3 to 6 years, more precisely when there are new developments in the computer paradigm that render the previous version obsolete, find a synthesis of the various proposals, and produce ONE document that describes the next step to which ALL compilers claiming compliance with that version must adhere.
It is true, there are successful languages that do not follow this "discrete" evolution scheme, such as C#/.NET Framework and the already mentioned Rust. But there is a notable difference: the governance and/or the strength given by the already acquired adopter base.
C# means Microsoft, just as Swift translates to Apple, Go to Google, and so on.
In these cases, it is the weight of the company behind the language that ensures both the critical mass of users and the security of the path taken.
Rust's story is a bit different. Rust was widely adopted because it seriously addressed security needs just when software security was experiencing the worst crisis in its history. In this case, it is the mass of its users that guarantees both the future and the support in development tools (with the absence of Visual Studio because Microsoft certainly does not view it sympathetically).
Now Atila, despite its not short lifespan an
 its undeniable qualities, D does not find itself in any of those fortunate conditions. On the contrary, it seems to me, it still has to offer developers a reason for its adoption, which certainly cannot pass through uncertainty about the path followed.

I apologize for having made it unbearably long.

June 08

On Friday, 7 June 2024 at 15:01:03 UTC, Federico wrote:

>
I am a very concrete person, Atila, so I judge things by

While your perspective is welcome, this forum is specifically for discussing DIP ideas. A discussion of D's prospects is off topic in this thread. Please see the forum rules linked at the top of the page if you're viewing from the web interface.

Normally, I'd delete the post outright. In this case, though, I'll just ask that anyone wanting to continue this discussion please start a new thread in the General forum. I will delete any further off-topic posts, though.

Thanks!

June 09

On Thursday, 30 May 2024 at 18:31:48 UTC, Atila Neves wrote:

>

https://github.com/atilaneves/DIPs/blob/editions/editions.md

Destroy!

I would just like to comment on one aspect of the DIP for now: the "Examples" section is a bit of a sore sight currently. It's difficult to get excited about the idea when the proposed actions it unlocks is "we're changing two defaults and removing three features without providing an immediate replacement".

Regarding the removal of lazy, I'm particularly curious about the consequent fate of assert and enforce, two prominent current users of `lazy. It seems like either way would involve a compromise:

  • Will assert fully become "compiler magic", unimplementable in user code, and enforce replaced with an explicit delegate variant?
  • Will both assert and enforce require an explicit delegate, thus making unit tests quite a bit more syntactically noisy?
  • Will both assert and enforce become "compiler magic" (and therefore unimplementable in user code)?