Closed ralphtheninja closed 5 years ago
It's completely possible that I'm missing something, please excuse my ignorance in that case :wink:
Maybe all xyz_with_depth() should be local only?
Possibly! I haven't seen it being used yet anywhere outside of this codebase yet, so I'm thinking it might indeed need to be private.
Perhaps we should make a little more progress on hypercore to check if it's indeed all private, and if it is we patch it here?
Really good catch!
Perhaps we should make a little more progress on hypercore to check if it's indeed all private, and if it is we patch it here?
Def! :heart:
Aaah ok. Maybe we can push those algorithms down to flat-tree
instead? Just thinking out loud.
I'll make a list here on the functions that do require using depth
:
flat.parent()
flat.index()
flat.offset()
flat.leftChild()
EDIT: removed flat.index()
since it always uses depth
and offset
parameters
@yoshuawuyts If you find other usage, please add to the list
@ralphtheninja will do!
I have an index, lets say
index = 44
and I want the offset, so I calloffset(44)
. Does it even make sense to calloffset_with_depth(44, 4)
?I suspect these functions are there because rust doesn't have default values for function parameters, which is the same thing for functions in c.
Maybe all
xyz_with_depth()
should be local only?Same goes for
.sibling()
,.parent()
etcMore concretely, does a calling lib ever pass in
depth
explicitly?