-
Notifications
You must be signed in to change notification settings - Fork 266
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
feat: Unicode strings (--unicode-char) #3016
Conversation
I guess it helps to have no actual character type. Or type checking for that matter. :)
Can’t just use string directly as a sequence without extra customization when —unicode-char
Just to close the loop, this is justified in "Printing Strings and Characters" in |
…code-strings # Conflicts: # Source/DafnyDriver/Commands/CommandRegistry.cs
| Java | `char` | `int` / `dafny.CodePoint` | | ||
| JavaScript | `string` of length 1 | `_dafny.CodePoint` (`number` wrapper) | | ||
| Python | `str` of length 1 | `_dafny.CodePoint` (`str` of length 1 wrapper) | | ||
| Go | `_dafny.Char` (`rune` wrapper) | `_dafny.CodePoint` (`rune` wrapper) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a wrapper needed around Go's rune
?
Source/DafnyRuntime/DafnyRuntimeJava/src/main/java/dafny/CodePoint.java
Outdated
Show resolved
Hide resolved
I originally thought compilers would need to reject some string values, but Go now handles invalid UTF-16 properly.
…code-strings # Conflicts: # Source/DafnyCore/Compilers/Compiler-js.cs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! This is a good feature and a clear stand on the issue of what Dafny strings are.
Awesome to see this process of careful design followed by implementation! |
Implementation of the design from dafny-lang/rfcs#13.
Resolves #413. Fixes #2928. Fixes #818. Fixes #3058. Fixes #1293. Fixes #3001.
Depends on #2976 to be fixed for the tests to pass consistently across platforms.
I've documented some of the less obvious compilation strategy decisions in
docs/Compilation/StringsAndChars.md
.Ready for review,
but will still add the fix to #2928 in the meantime (since it's easy to add as another test case in this set and most of the work is already done).By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.