Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document identifier index limit #44

Open
travisbrown opened this issue Apr 18, 2020 · 0 comments
Open

Document identifier index limit #44

travisbrown opened this issue Apr 18, 2020 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@travisbrown
Copy link
Owner

The Haskell implementation will happily parse an arbitrarily large index on an identifier (although it looks like something's overflowing either in the representation or the encoding):

$ dhall encode --json <<< "x @ 9223372036854775808"
[
    "x",
    -9223372036854775808
]

We stop at Long.MaxValue:

scala> import org.dhallj.parser.DhallParser
import org.dhallj.parser.DhallParser

scala> DhallParser.parse("x @ 9223372036854775807")
res0: org.dhallj.core.Expr.Parsed = x@9223372036854775807

scala> DhallParser.parse("x @ 9223372036854775808")
java.lang.NumberFormatException: For input string: "9223372036854775808"
  at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)
  at java.base/java.lang.Long.parseLong(Long.java:703)
  ...

I think this is fine, since nobody's ever going to bind 9,223,372,036,854,775,808 xs, so this will never type-check, anyway, but we should document the difference and maybe wrap the NumberFormatException in an ParseException.

@travisbrown travisbrown added the documentation Improvements or additions to documentation label Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant