Jump to page: 1 25  
Page
Thread overview
May 30

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

Destroy!

May 31
> No exceptions

Doesn't need to be an edition, its not an either/or situation.

> Change class ABI (monitor) and/or hierarchy

Instead of changing Object I have proposed that we introduce custom roots. Then people use whatever fits their needs.

---

I'm happy to see the change to an integer for editions.

I do want to see D2 (version 2) to be defined as missing DIP1000 enforcement.

There is missing all of the release scheduling as well as a guarantee of when an edition is made. It shouldn't be done yearly (see languages like Rust or C#).

It would also be nice to see a work in progress edition which includes all the currently approved preview flags, so that people can get a feel of what the next edition is going to be like (find bugs ext.).
May 30

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

>

The feature is meant to be backwards and forwards compatible: D modules of different editions should be able to import each other.

This is critically important for editions to work, but how would it be implemented? Suppose safe becomes the default in the future. How would a module from a recent edition interact with a module from an old edition?

May 30
On Thursday, 30 May 2024 at 18:43:43 UTC, Richard (Rikki) Andrew Cattermole wrote:
> > No exceptions
>
> Doesn't need to be an edition, its not an either/or situation.
>
> > Change class ABI (monitor) and/or hierarchy
>
> Instead of changing Object I have proposed that we introduce custom roots. Then people use whatever fits their needs.
>
> ---
>
> I'm happy to see the change to an integer for editions.
>
> I do want to see D2 (version 2) to be defined as missing DIP1000 enforcement.
>
> There is missing all of the release scheduling as well as a guarantee of when an edition is made. It shouldn't be done yearly (see languages like Rust or C#).
>
> It would also be nice to see a work in progress edition which includes all the currently approved preview flags, so that people can get a feel of what the next edition is going to be like (find bugs ext.).

That would be the `-edition=2024` switch. I don't think the edition needs to be finalised before we introduce the compiler switch.
May 30

On Thursday, 30 May 2024 at 19:36:30 UTC, bachmeier wrote:

>

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

>

The feature is meant to be backwards and forwards compatible: D modules of different editions should be able to import each other.

This is critically important for editions to work, but how would it be implemented? Suppose safe becomes the default in the future. How would a module from a recent edition interact with a module from an old edition?

In that case @system would be the default for the imported module. There are probably some cases that will be tricky, but I don't think this is one of them.

module old;
void foo() { } // no annotation so @system
module(2024) new_;
import old;
void bar() { // no annotation so @safe
    foo; // ERROR, cannot call `@system` function `foo` in `@safe` function `bar`.
}
May 30

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

>

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

Destroy!

minor nit, in the grammar changes it look like module foo 2024;, without parentheses, is allowed. Is that intended?

May 31

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

>

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

Destroy!

How are editions going to retain compatibility across modules with different ABIs? I believe that combinations of inheritance and interface implementations may make this quite challenging.

A probably needlessly convoluted example would be this:

  • a module A, edition 2024, containing a class Foo
  • a module B, edition 2024+x, containing a class Bar, and
  • a module C, edition 2024+y, defining an interface IFooBar and two classes FooBar_Foo and FooBar_Bar that derive from Foo and Bar respectively, but implement the IFooBar interface on top of them.

Any function that takes a IFooBar should be able to take both implementation interchangeably. But how would this work if there was an ABI change to the class memory layout affecting Foo and Bar?

May 31
On Thursday, 30 May 2024 at 18:31:48 UTC, Atila Neves wrote:
> https://github.com/atilaneves/DIPs/blob/editions/editions.md
>
> Destroy!

> Templates would obey the rules of the edition of the module they are defined in, not the module where they are instantiated.

Including mixin templates?
May 31
Atila Neves kirjoitti 30.5.2024 klo 21.31:
> https://github.com/atilaneves/DIPs/blob/editions/editions.md
> 
> Destroy!

I suggest a different syntax. I think it should be something that would lend itself to enabling/disabling individual features (compiler switches) module-wise.

I'm not necessarily arguing we should make our current compiler switches capable of being turned on or off module by module, just that if we decided to to that, we could use the same syntax to do it. Therefore, a decimal without any keywords is probably bad.

Version specifications are IMO a good tool for this. Just like the proposed edition declarations, a specification is local to the module.

```D
module core.atomic;
version = D_2024;
/+ If we decided to allow it, this
   syntax would work for compiler switches
   (although we'd probably need a version
   specification for the reverse setting
   too)
+/
version = D_NoBoundsChecks;
```

Another possibility is pragmas. This is what Haskell, or more precisely it's Glasgow compiler does to accomplish the same. I also think it's per-module extension would be well worth putting to "prior work" section (and investigating if you haven't already).

Another issue, that doesn't strictly affect the design of this DIP but should be given cosideration as soon as it's used for enabling features selectively. Suppose `@safe` is the default for edition 2026 but the present rules apply for edition 2024. What should happen in this case?

```D
#line 1 "modulea.d"
module modulea 2024;

template T(int i)
{   // No explicit attributes.
    // Note, no auto inference, because only eponymous
    // functions inside a template get auto-inference.
    int incr(int j) => i + j;
}

#line 1 "moduleb.d"
module moduleb 2026;
import modulea;

//Defined within edition 2024, but instantiated within edition 2026.
//@safe or @system?
//I quess @system but I want to read your opinion.
alias incr = T!(3).incr;
```

As a whole, I'm highly receptive to this DIP.
May 31

On Thursday, 30 May 2024 at 23:34:27 UTC, Nicholas Wilson wrote:

>

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

>

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

Destroy!

minor nit, in the grammar changes it look like module foo 2024;, without parentheses, is allowed. Is that intended?

I've been through so many versions now that I don't remember what I intended :P

I generally think that parens are usually visual noise, so maybe this is better?

« First   ‹ Prev
1 2 3 4 5