Implement visitFloat32, visitFloat64String for Byte/Short/Int/Long/Float/Double/Char - #358
Conversation
|
@htmldoug looks good, feel free to merge |
|
@htmldoug could we add a unit test too? just to make sure this is fixing what we it should be fixing |
|
Sure. Tests found |
|
looks good to me |
|
Not sure if the copypaste code can easily be moved into some private helper function, but if it can that would help DRY things up a bit |
|
Refactored out a |
|
Seems good enough. This repo isn't particularly strict about visibility anyway. Feel free to merge |
|
TBH I'd have put the logic into a static helper function somewhere that the various readers call from their override of We do a lot of fancy trait cake stuff in the repo but I like static functions where we can get away with then |
|
I agree in principle, although it's a little tricky since they need to delegate to other instance methods. Would either of these approaches be better? def helper(s: String): (String, Int, Int) = ???
// each Reader:
def visitFloat64String(s: String, index: Int): T = {
val (s, decIndex, expIndex) = helper(s)
visitFloat64StringParts(s, decIndex, expIndex, index)
}def helper[T](s: String, visitFloat64StringParts: (String, Int, Int) => T): T = ???
// each Reader:
def visitFloat64String(s: String, index: Int) = helper(s, visitFloat64StringParts(_, _, _, index)) |
visitFloat32, visitFloat64String for Byte/Short/Int/Long/Float/Double/Char
|
Oh if a static helper is tricky lets just go with the trait then |
Fixes #354.