Hacker News new | past | comments | ask | show | jobs | submit login

I wonder if they could have used Smallvec, it sounds like the best of both worlds for performance: stack allocated up to a size.

Off-topic but the JVM will be the second platform to get const generics support -> https://www.reddit.com/r/java/comments/m2dfb5/parametric_jvm...

Are there other languages than rust that supports it?




> Are there other languages than rust that supports it?

I'm no expert on the terminology, but C++ templates can take values as template arguments (I think this is what is called "const generics" in Rust), and languages such as Julia are even more powerful.


> Are there other languages than rust that supports it?

Const generics are essentially a really small subset of fully dependent types, which are implemented in Idris 2 and other research languages.


Unless you mean strictly generics, D has had the ability to do this and a lot more (e.g. accept user defined types as parameters) since at least 2014 or so


C++ has supported non-type template parameters for a very long time now. Since C++ 20, it also supports class literals to be used as non-type template parameters




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: