11 hours ago

On Wednesday, 1 October 2025 at 20:00:35 UTC, monkyyy wrote:

>

On Wednesday, 1 October 2025 at 18:09:27 UTC, Ogion wrote:

>

On Wednesday, 10 September 2025 at 23:35:29 UTC, JN wrote:

>

I feel like in such scenario a warning should be issued, or even compilation error, "static array initialization expects 10 values, only 1 provided". Sooner or later someone will hit the same issue again and spend hours debugging why the array doesn't get zeroed.

Yep, the syntax should be more explicit. Something like this:

float[10] x = [42, ...];   // [42, NaN, ..., NaN]
float[10] y = [1:42, ...]; // [NaN, 42, NaN, ..., NaN]

nah they just going to break it without a replacement

you can always create a mixin

10 hours ago

On Wednesday, 1 October 2025 at 21:01:28 UTC, not you wrote:

>

On Wednesday, 1 October 2025 at 20:00:35 UTC, monkyyy wrote:

>

On Wednesday, 1 October 2025 at 18:09:27 UTC, Ogion wrote:

>

On Wednesday, 10 September 2025 at 23:35:29 UTC, JN wrote:

>

I feel like in such scenario a warning should be issued, or even compilation error, "static array initialization expects 10 values, only 1 provided". Sooner or later someone will hit the same issue again and spend hours debugging why the array doesn't get zeroed.

Yep, the syntax should be more explicit. Something like this:

float[10] x = [42, ...];   // [42, NaN, ..., NaN]
float[10] y = [1:42, ...]; // [NaN, 42, NaN, ..., NaN]

nah they just going to break it without a replacement

you can always create a mixin

replacing 1 line of code with 30 isnt great

9 hours ago

On Wednesday, 1 October 2025 at 21:28:00 UTC, monkyyy wrote:

>

On Wednesday, 1 October 2025 at 21:01:28 UTC, not you wrote:

>

On Wednesday, 1 October 2025 at 20:00:35 UTC, monkyyy wrote:

>

On Wednesday, 1 October 2025 at 18:09:27 UTC, Ogion wrote:

>

On Wednesday, 10 September 2025 at 23:35:29 UTC, JN wrote:

>

[...]

Yep, the syntax should be more explicit. Something like this:

float[10] x = [42, ...];   // [42, NaN, ..., NaN]
float[10] y = [1:42, ...]; // [NaN, 42, NaN, ..., NaN]

nah they just going to break it without a replacement

you can always create a mixin

replacing 1 line of code with 30 isnt great

how often do you need this 'feature'? can you show a real world usecase?

36 minutes ago

On Monday, 8 September 2025 at 15:44:27 UTC, Walter Bright wrote:

>

https://dlang.org/spec/arrays.html#static-init-static

I've been programming in D for many years because of such wonderful language features. But, in my opinion, we need to focus on stabilizing and fixing what we already have. Speaking of static arrays, I’d like to remind that we've had a long-standing bug with a segmentation fault: type inference doesn't work for a static array of type real[1].

void main() {
    import std.stdio : writeln;
    real[1] arr = 0;
    writeln(arr); // SEGFAULT
}

https://github.com/dlang/dmd/issues/21323

21 minutes ago

Correction: array output to screen does not work.

1 2
Next ›   Last »