Skip to content
This repository has been archived by the owner on Nov 28, 2017. It is now read-only.

org.json4s.ast.safe use String or BigDecimal, or should it be a sealed abstract class? #16

Open
mdedetrich opened this issue Nov 5, 2015 · 0 comments

Comments

@mdedetrich
Copy link
Contributor

There is currently debate at scala/slip#28 for what the internal representation for a org.json4s.ast.safe.JNumber should be. Currently its a BigDecimal, however there are valid issues with using BigDecimal

On approach from @djspiewak is to use a String, along with a private constructor that checks if the string is a valid number with a cached regex (we need to do this, as safe needs to guarantee that a JNumber is actually a valid number)

Another approach, used by https://github.com/argonaut-io/argonaut, is to have JNumber as a sealed abstract class with different number types as options. I am less open to this as it creates a lot of complexity, prefer the string approach with having a regex to check that its valid

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant