digitalmars.D - I have implemented DIP1039 - Static Arrays with Inferred Length
- xoxorwr (11/11) Feb 23 This is something I miss a lot whenever I come back to D from
- Adam D. Ruppe (4/5) Feb 23 Thanks for the patch, I just applied it to opend and am building
- matheus (5/18) Feb 23 Nice feature.
- Mike Parker (5/8) Feb 24 The old process, sure. Now in this case, where the DIP already
- Nick Treleaven (17/23) Feb 27 ```d
- Nick Treleaven (2/5) Feb 27 Sorry, `imported!std.array.staticArray!int([1, 2, 3])`.
- Adam D. Ruppe (2/3) Feb 27 i think you mean `imported!"std.array".staticArray!int([1, 2, 3])`
This is something I miss a lot whenever I come back to D from other languages. There's always been that friction when dealing static arrays that's very annoying - you either have to manually count elements - or have to tap into phobos `auto arr = [1, 2, 3].staticArray;` But no more! PR is ready for review: https://github.com/dlang/dmd/pull/22623 There was a DIP for it, but honestly, the review process is way too stalled and convoluted, it's become over engineered for what is ultimately a minimal diff for a minimal feature.
Feb 23
On Monday, 23 February 2026 at 19:54:39 UTC, xoxorwr wrote:But no more! PR is ready for review:Thanks for the patch, I just applied it to opend and am building a release right now. Should be ready for download in about 30 mins...
Feb 23
On Monday, 23 February 2026 at 19:54:39 UTC, xoxorwr wrote:This is something I miss a lot whenever I come back to D from other languages. There's always been that friction when dealing static arrays that's very annoying ... But no more! PR is ready for review: https://github.com/dlang/dmd/pull/22623 ...Nice feature. On Monday, 23 February 2026 at 20:25:14 UTC, Adam D. Ruppe wrote:On Monday, 23 February 2026 at 19:54:39 UTC, xoxorwr wrote:Wow, you (opend) are fast. =] Matheus.But no more! PR is ready for review:Thanks for the patch, I just applied it to opend and am building a release right now. Should be ready for download in about 30 mins...
Feb 23
On Monday, 23 February 2026 at 19:54:39 UTC, xoxorwr wrote:There was a DIP for it, but honestly, the review process is way too stalled and convoluted, it's become over engineered for what is ultimately a minimal diff for a minimal feature.The old process, sure. Now in this case, where the DIP already exists, you just post the draft in the development forum for feedback, and when you think you're ready to submit, you let me know and done.
Feb 24
On Monday, 23 February 2026 at 19:54:39 UTC, xoxorwr wrote:This is something I miss a lot whenever I come back to D from other languages. There's always been that friction when dealing static arrays that's very annoying - you either have to manually count elements - or have to tap into phobos `auto arr = [1, 2, 3].staticArray;````d int[$] arr = [1, 2, 3]; ``` It's OK, however: - Doesn't work as an expression - except `(){ int[$] arr = [1, 2, 3]; return arr; }()`, which is no better than `imported!std.array.staticArray!int(1, 2, 3)`. - Requires specifying the element type, which may be a complicated type I think the typical case may be not wanting to specify the element type. If that is correct, it would be better to have syntax for a static array literal. E.g. `[1, 2, 3]$`. So maybe we need some data about use cases before picking a solution. Also I note that `staticArray` would be fine if it was in `object` (instead of various uncommon AA functions) so it didn't need an import.
Feb 27
On Friday, 27 February 2026 at 11:19:15 UTC, Nick Treleaven wrote:
- Doesn't work as an expression - except `(){ int[$] arr = [1,
2, 3]; return arr; }()`, which is no better than
`imported!std.array.staticArray!int(1, 2, 3)`.
Sorry, `imported!std.array.staticArray!int([1, 2, 3])`.
Feb 27
On Friday, 27 February 2026 at 11:24:03 UTC, Nick Treleaven wrote:Sorry, `imported!std.array.staticArray!int([1, 2, 3])`.i think you mean `imported!"std.array".staticArray!int([1, 2, 3])`
Feb 27









Adam D. Ruppe <destructionator gmail.com> 