cucapra / pollen

generating hardware accelerators for pangenomic graph queries
MIT License
24 stars 1 forks source link

Stronger types for indices #174

Closed sampsyo closed 1 month ago

sampsyo commented 1 month ago

This makes the Id (previously called Index) and Span types in our arena library parameterized on the type they refer to. So, for example, Id<Segment> is still "just" a u32, but it is a distinct type from Id<Path> (which is also just a u32 under the hood, of course). This makes the code a little more self-documenting and makes it impossible to confuse references to different types. It is, of course, still very much possible to confuse ids for different arenas of the same type!

Anyway, this was quite a bit less painful than I was expecting, so I think it's probably a good idea, despite the extra complexity.