Open toyboot4e opened 3 years ago
I tried adding it.
(Edit: implemtended Clone
, Copy
and Debug
manually)
I like the idea of strongly typed keys, but I'm not sure whether they belong in Thunderdome as-is. We could add a new IndexT<T>
type with the existing arena, but we could also add a new submodule that works with only strongly-typed methods.
~Thought about this some more. Maybe we could add the type parameter but make it default to ()
? That way, existing consumers aren't impacted.~
EDIT: This would break a lot of consumers who now need to specify what their Index
type is. Default type doesn't help here.
I thought about this some more. If we wanted to, we could introduce another type parameter on Arena
that is the type used for the indices.
Arena<T, I = ()>
would have indices of type Index<I>
. Existing consumers should be unaffected, and users could opt into an additional smidge of type safety.
LGTM! Today I’m using my own arena and I'm not going to make a PR, but that sounds clever.
I thought about this some more. If we wanted to, we could introduce another type parameter on
Arena
that is the type used for the indices.
Arena<T, I = ()>
would have indices of typeIndex<I>
. Existing consumers should be unaffected, and users could opt into an additional smidge of type safety.
I would appreciate this feature a lot actually.
edit: Implemented in https://github.com/LPGhatguy/thunderdome/pull/39
Can I hear your thoughts on adding type parameter
T
toIndex
?For example, current
Index
in thunderdome would look like this:If
Index
is typed withT
, it would look like this:It depends on preferences, but I thought the latter would make more sense.
What would you think? Thank you.