-
-
Notifications
You must be signed in to change notification settings - Fork 173
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
Natural / Integer syntax suggestion #138
Comments
Yeah, it's a pretty breaking change, but I still think it's a good idea and I agree with all the points you made. I think it's mainly a matter of giving this issue more visibility so that people can chime in about whether or not they think the disruption is worth the benefit. I'll try to broadcast this more widely. |
I 100% support this! |
I think the cleanup to arithmetic is worth it. |
@sellout I would note that the cardinality is the same in either case. |
@vmchale Yeah, that‘s why I added the “(?)” 😄 I just didn’t have a better term for it. |
Also, this would probably also change the behavior of One consequence of this would be that there would be no way to render a positive |
Sounds like a good idea. A small conversion utility might be helpful for upgrading. I dunno how many users Dhall has at the moment, but it’s a very new language, and IMO people should expect some breaking changes while the core language is being figured out. |
I totally agree with all of this thread 👍 |
Seems like unanimous agreement to me. If nobody objects by tomorrow then we should proceed with a pull request to change the semantics. @sellout: Did you want to submit the pull request? If not, I can do so |
Fixes #138 This changes the grammar for `Natural` numbers to no longer require a leading `+` and changes the grammar for `Integer`s to require a leading `+` for non-negative `Integer`s. This also makes a matching change to `Integer/show` and `Natural/show` to reflect the changes to the grammar since they must generate valid Dhall code
I put up a pull request with the proposed change to the grammar and semantics in #141 |
Fixes #138 This changes the grammar for `Natural` numbers to no longer require a leading `+` and changes the grammar for `Integer`s to require a leading `+` for non-negative `Integer`s. This also makes a matching change to `Integer/show` and `Natural/show` to reflect the changes to the grammar since they must generate valid Dhall code
The parser tests had a number of cases where they had Natural and Integer syntax swapped round. This presumably dates from before dhall-lang#138 switched the grammar of Integer and Natural. Note that this difference doesn't actually matter for these parsing tests, because an expression like `+1 : Natural` still parses correctly, it just fails to typecheck. But I found it confusing to have the syntax so consistently backwards in the tests, so I thought it was worth changing.
The parser tests had a number of cases where they had Natural and Integer syntax swapped round. This presumably dates from before #138 switched the grammar of Integer and Natural. Note that this difference doesn't actually matter for these parsing tests, because an expression like `+1 : Natural` still parses correctly, it just fails to typecheck. But I found it confusing to have the syntax so consistently backwards in the tests, so I thought it was worth changing.
tl;dr: Change the grammar to move the
+
sigil to Integers and Doubles, likeI have a few justifications for this:
Natural
, withInteger
andDouble
being extremely rare (I find this true of coding in Haskell, as well – it’s mostly the lack of availability of Naturals that makes it not the case in other languages, IMO, although I know it does also depend on the domains that one works in)Natural
is the only numeric type with operations, so+2 + +3
is, to me, much harder to read than2 + 3
I know it’s also a significant breaking change across like every config file ever, so …
The text was updated successfully, but these errors were encountered: