News for hackers. Stuff that matters.
Re:Methods for Array Initialization in Rust (2018) by chrismorgan on Monday May 24, 2021 @09:01AM (#27263832)
It’s a historical limitation, with the power of lifting it only very recently stabilised (in the last couple of releases). Most things that were limited to 32 when this article was written aren’t any more, though the Default trait implementation still is.

The key term to search for and read up on is const generics.

This style of limitation is still present on tuples, which have implementations for common traits for up to 12-tuples. (See the bunch of implementations around https://doc.rust-lang.org/std/cmp/trait.PartialEq.html#impl-... as an example, comparing it with the single “PartialEq<[B; N]> for [A; N]” implementation for all arrays!) This limitation will probably be sorted out eventually, but it takes time to settle on a design that satisfies everyone and is implementable.

Re:Methods for Array Initialization in Rust (2018) by masklinn on Monday May 24, 2021 @10:02AM (#27264454)
> This limitation will probably be sorted out eventually, but it takes time to settle on a design that satisfies everyone and is implementable.

That sounds unlikely, it’s would require not just const generics but some sort of variable arity generics.

If Haskell doesn’t have it, I don’t really see Rust getting it.

Re:Methods for Array Initialization in Rust (2018) by Diggsey on Monday May 24, 2021 @11:31AM (#27265527)
Why not? Rust isn't limited to what Haskell does, and a lot of it's features are driven by a desire for parity with C++, which does have variadic generics.

Other languages in the same domain (like D) also have variadic generics.

Re:Methods for Array Initialization in Rust (2018) by masklinn on Monday May 24, 2021 @02:15PM (#27267800)
Because Rust’s generics are patterned after Haskell’s (traits are dual to type classes), not C++’ templates.
Re:Methods for Array Initialization in Rust (2018) by Diggsey on Sunday May 30, 2021 @07:16PM (#27337930)
You're conflating traits with generics. Generics exist without traits, and in Rust they are more closely aligned with C++ templates than anything else, since they are implemented via monomorphisation, whereas in Haskell they are not.

Regardless, Rust is not "patterned" after a single other language. It's influenced by many langauges, so it makes no sense to say that one feature is just copied straight from a specific other language.

Re:Methods for Array Initialization in Rust (2018) by swsieber on Monday May 24, 2021 @10:48AM (#27264984)
There have been various variable arity generic discussions on the internals forum (internals.rust-lang.org), but I think it's a significantly lower priority issue than the other stuff in flight. I think we might get it in a few years.
Re:Methods for Array Initialization in Rust (2018) by chrismorgan on Monday May 24, 2021 @08:35PM (#27271406)
This is my position, too. I think everyone agrees that we want to get generic tuples, but there are other higher priority issues still, so it’s mostly more a backburner project worth thinking about when designing things, and slowly working towards as good a design as we can come up with which fits in with the rest of the language (including future possibilities) as well as possible. Even in a vacuum it’s not trivial to design something both satisfactory and implementable, and when you add other language features, corners the language has been designed into, and corners you want to avoid painting the language into, it gets much harder still.