Thread overview
Beta 2.103.0
Mar 02, 2023
Iain Buclaw
Mar 02, 2023
ryuukk_
Mar 03, 2023
Dmitry Olshansky
Mar 23, 2023
Dukc
Mar 02, 2023
jmh530
Mar 02, 2023
jmh530
Mar 02, 2023
Bastiaan Veelo
Mar 02, 2023
jmh530
Mar 16, 2023
Iain Buclaw
Mar 16, 2023
M.M.
March 02, 2023

Glad to announce the first beta for the 2.103.0 release, ♥ to the 43 contributors.

This release comes with 9 major changes, including:

  • In the compiler, -preview=dip25 is now enabled by default.
  • In the standard library, std.uni Grapheme functions have been updated to conform to Unicode 15
  • In dub, the --color argument now accepts the values auto, never, and always.

http://dlang.org/download.html#dmd_beta
http://dlang.org/changelog/2.103.0.html

As usual please report any bugs at https://issues.dlang.org

-Iain
on behalf of the Dlang Core Team

March 02, 2023

On Thursday, 2 March 2023 at 14:40:04 UTC, Iain Buclaw wrote:

>

Glad to announce the first beta for the 2.103.0 release, ♥ to the 43 contributors.

This release comes with 9 major changes, including:

  • In the compiler, -preview=dip25 is now enabled by default.
  • In the standard library, std.uni Grapheme functions have been updated to conform to Unicode 15
  • In dub, the --color argument now accepts the values auto, never, and always.

http://dlang.org/download.html#dmd_beta
http://dlang.org/changelog/2.103.0.html

As usual please report any bugs at https://issues.dlang.org

-Iain
on behalf of the Dlang Core Team

@safe ref int wrongIdentity(ref int x) {
    return x; // ERROR! Cannot return a ref, please use "return ref"
}
@safe ref int identity(return ref int x) {
    return x; // fine
}

a keyword to return a value

return 5;

and a keyword to tell that a reference is returnable

return ref int x

that's dumb, why?

March 02, 2023

On Thursday, 2 March 2023 at 14:40:04 UTC, Iain Buclaw wrote:

>

Glad to announce the first beta for the 2.103.0 release, ♥ to the 43 contributors.

[snip]

I see some typos in the changelog (stars around what I noticed):

(Compiler changes #5)
Up until this release, D had both traits(isVirtualFunction) and traits(isVirtualMethod) (and their coressponding traits(get...) counterpart). The differenrcte between the two is that isVirtualFunction returns true for final methods that do not override anything.

(this sentence is listed for both library change #2 and #3)
As the template constraint is not used to overload the symbol template function, the constrains are move into static asserts with expressive error messages.

>
  • In dub, the --color argument now accepts the values auto, never, and always.

Any reason why it doesn't match the options from DMD?

I recall some discussion about how to get the colors working on Windows, but it's been a long time and hard to find. It might be good to add something like "Here's an example on Windows 1X" to https://dlang.org/dmd-windows.html

March 02, 2023

On Thursday, 2 March 2023 at 16:40:12 UTC, jmh530 wrote:

>

On Thursday, 2 March 2023 at 14:40:04 UTC, Iain Buclaw wrote:

>

Glad to announce the first beta for the 2.103.0 release, ♥ to the 43 contributors.

[snip]

I see some typos in the changelog (stars around what I noticed):

[snip]

I guess with markdown, the stars became italics

March 02, 2023

On Thursday, 2 March 2023 at 16:40:12 UTC, jmh530 wrote:

>

Any reason why it doesn't match the options from DMD?

See the changelog:

>

The previous automatic, on, off values are still supported, but undocumented, because they are used in almost no other program like this. For consistency, with other Linux tools especially, we have implemented and switched the defaults to the widely-used auto, never, always values.

March 02, 2023

On Thursday, 2 March 2023 at 18:35:36 UTC, Bastiaan Veelo wrote:

>

On Thursday, 2 March 2023 at 16:40:12 UTC, jmh530 wrote:

>

Any reason why it doesn't match the options from DMD?

See the changelog:

>

The previous automatic, on, off values are still supported, but undocumented, because they are used in almost no other program like this. For consistency, with other Linux tools especially, we have implemented and switched the defaults to the widely-used auto, never, always values.

Thanks. I must have missed that...

March 03, 2023

On Thursday, 2 March 2023 at 15:56:35 UTC, ryuukk_ wrote:

>

On Thursday, 2 March 2023 at 14:40:04 UTC, Iain Buclaw wrote:

>

Glad to announce the first beta for the 2.103.0 release, ♥ to the 43 contributors.

This release comes with 9 major changes, including:

  • In the compiler, -preview=dip25 is now enabled by default.
  • In the standard library, std.uni Grapheme functions have been updated to conform to Unicode 15
  • In dub, the --color argument now accepts the values auto, never, and always.

http://dlang.org/download.html#dmd_beta
http://dlang.org/changelog/2.103.0.html

As usual please report any bugs at https://issues.dlang.org

-Iain
on behalf of the Dlang Core Team

@safe ref int wrongIdentity(ref int x) {
    return x; // ERROR! Cannot return a ref, please use "return ref"
}
@safe ref int identity(return ref int x) {
    return x; // fine
}

a keyword to return a value

return 5;

and a keyword to tell that a reference is returnable

return ref int x

that's dumb, why?

return ref is probably the tipping point for me. Even if better keyword is used the accrual of complexity never ends. Though arguably transitive qualifiers and inout were the point of no return. Recently I had a case where in 64-bit mode a data-structure could be implicitly converted to immutable while in 32-bit it wouldn’t. After some mucking around a seemingly unrelated change fixed it, the error message gave no clue of what’s wrong.

Anyway I’d have a hard time selling transitive qualifiers in particular shared, as most of the time shared object is taken off the queue and should become thread-local. The type system doesn’t want to hear any of it. Seems like ownership system beats transitive qualifiers here, albeit both add significant friction.


Dmitry Olshansky

March 16, 2023

On Thursday, 2 March 2023 at 14:40:04 UTC, Iain Buclaw wrote:

>

Glad to announce the first beta for the 2.103.0 release

The release candidate for 2.103.0 is now available, which has 11 bug fixes since the initial beta release.

http://dlang.org/download.html#dmd_beta
http://dlang.org/changelog/2.103.0.html

As usual please report any bugs at https://issues.dlang.org

-Iain
on behalf of the Dlang Core Team

March 16, 2023

On Thursday, 16 March 2023 at 09:13:04 UTC, Iain Buclaw wrote:

>

On Thursday, 2 March 2023 at 14:40:04 UTC, Iain Buclaw wrote:
...
The release candidate for 2.103.0 is now available, which has 11 bug fixes since the initial beta release.
...

Good to hear the beta was useful.

March 23, 2023

On Thursday, 2 March 2023 at 15:56:35 UTC, ryuukk_ wrote:

>
@safe ref int wrongIdentity(ref int x) {
    return x; // ERROR! Cannot return a ref, please use "return ref"
}
@safe ref int identity(return ref int x) {
    return x; // fine
}

a keyword to return a value

return 5;

and a keyword to tell that a reference is returnable

return ref int x

that's dumb, why?

Late answer, but it happens because DIP25 is now the default. ref without return means that the return value cannot refer to the parameter in question. You can alternatively fix this by turning function attribute inference on, by omitting int from the function header.

Why DIP25 is needed? Consider this:

int* pointer1;
int* pointer2;

@safe ref int incrementAndCopy(ref int x)
{   return *new int(x++);
}

@safe unittest
{   int local = 0;

    pointer1 = &local.identity;
    pointer2 = &incrementAndCopy(local);
}

The compiler must prevent the first assignment to pointer, because otherwise it would end up pointing to an expired stack variable. On the other hand, we don't want to disallow harmless usage of ref like that of the incrementAndCopy call in the second assignment. To achieve that, the compiler needs to distinguish between ref variables that may be referenced to by the return value, and those that cannot. Plain ref means it can not, return ref means it can.