-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Consider a third Rust implementation:
pub struct ZBHO {
start: u64,
end: u64
}
...3 more
then define Traits for basis and openness. IIUC, In this way you could define impl for functions which have different implementations depending on e.g. openness, like len, with full compile time monomorphization and no runtime type checks as in our existing two implementations
i imagine something like
pub trait DifferentialBehavior {
fn len(&self) -> u64;
}
impl DifferentialBehavior for ZBHO {
fn len(&self) -> u64 {
self.end - self.start
}
}
// and same exact impl for OBHO
In fact you may be able to combine this strategy with your zero sized type parameters to reduce duplication and instead write something like
impl<T: HalfOpen> for Interval<B, T>
although I'm not sure how you specialize on just one type. probably still works.
if you can do this I have to change the part of the paper explaining the drawbacks to the Rust implementations include runtime checks =)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request