3 ms·
> The language sorely needs some sort of comptime interface / traits / concepts, anytype-everything is not nice. I'm not sure I agree. Anything which attempts
by bsder 3y ago
> The language sorely needs some sort of comptime interface / traits / concepts, anytype-everything is not nice.
I'm not sure I agree. Anything which attempts to constrain "anytype" makes the language much, much more complicated.
For example, if it were constrained, Zig "allocgate" would likely have necessitated compiler changes instead of just library changes.
And I often think that we conflate two different things--"Generic" and "Libraries like the big boys build".
I generally don't need fully generic programming.
What I do need is the ability to build a library that works exactly like the standard library. All libraries need to be precisely equal in expressive power and composability to those that have been officially "blessed".
Oddly, Rust fails at this due to things like the Orphan Rule even though its "genericity" is quite expansive. The invasiveness of Serde is a prime example. If an external crate doesn't support Serde, you can't add it. You have to literally copy the entire library over to your code in order to add Serde support. This blocks an alternative to Serde from ever arising because it will never be as convenient as Serde which has been "blessed" by the community.