-
Notifications
You must be signed in to change notification settings - Fork 51
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
Introduce DiplomatStr
#367
Conversation
This and the other PR should not be called WTF-whatever, WTF-8 is very specific encoding that has a documented way of storing unpaired surrogates. This is unvalidated UTF-8, it should be called |
ok |
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.
What if people still have str
in their diplomat code?
|
They have to upgrade. We've already made a macro-breaking change with the |
I'd rather add We should also have a |
I'm doing this manually for Dart at the moment, I'm not sure if automating it with more config is worth the effort for us at least. |
Not in the short run, no. In the short run we should do exactly what you're doing. Post 2.0 when we've gotten rid of all AST backends we should design diplomat CFGs that cover all the use cases that crop up and move to that, I'd like to not have the bridge mention backends for any reason other than "this backend does not support this feature currently but could". |
#57
The existing usage of
str
in Diplomat is that it basically represents WTF8 on the ABI. This PR pushes the validation from the diplomat glue into the Rust library, which might be able to handle invalid UTF-8, so validation might not be necessary.My plan is to add
DiplomatStr16
next. If we want to we can addstr
back, but this time the glue code would do an unsafe unwrap, and these APIs should only be enabled if the caller can do validation, and should be documented to be UB if used incorrectly.