News for hackers. Stuff that matters.
Re:Rust const generics MVP hits beta by adamch on Friday February 26, 2021 @12:35PM (#26277418)
Wow, higher-kinded data. I've never heard of that, but it would absolutely be useful. E.g. for converting JSON inputs, where any field might be missing, into a version of the data which definitely has values for all the fields. Or a version of the struct where the values are actually read from a cache/database.
Re:Rust const generics MVP hits beta by twic on Friday February 26, 2021 @02:05PM (#26278480)
I proposed using it to model lifecycles of entities:

https://github.com/tim-group/higher-kinded-lifecycle/blob/ma...

(in this code, "idea" is a domain concept from the firm i worked for at the time - basically a recommendation to buy a stock, which is 'opened' on a certain date, and 'closed' when it no longer seems like a good recommendation)

My collegues didn't like it, and stuck to using separate types for objects in different stages of the lifecycle!

Re:Rust const generics MVP hits beta by IggleSniggle on Friday February 26, 2021 @03:35PM (#26279554)
TypeScript (as you might expect from a lang built for dealing with JS Objects), has really great tooling for this kind of type narrowing these days (including on string template matching now) and I miss it so much now that I’m writing Go.
Re:Rust const generics MVP hits beta by glittershark on Friday February 26, 2021 @12:45PM (#26277539)
yes! once you use it you start wanting it everywhere, which is a big part of why I wish I could do it in Rust