Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The design of generics in this one seems rather well balanced in simplicity vs power.

The part about interface-typed values [1] is interesting. They do dynamic dispatch as a fallback when the function is too polymorphic to be be specialized.

In Rust terms it's as if it picks between `dyn` and `impl` automatically. It looks convenient, but also a bit of a non-obvious performance pitfall.

[1] https://shader-slang.com/slang/user-guide/interfaces-generic...



It seems like the type checker could call out polymorphic functions both when compiling and even highlighting them in the editor when checking for type errors.




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

Search: