-
Notifications
You must be signed in to change notification settings - Fork 249
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
Figure out optional dictionary fields #188
Comments
Thinking by documenting here:
I think what I'm proposing here is to use E.g. in Swift, a struct TVCharacter {
let name: String
let yearsActive: Int = 0
}
let roslin = TVCharacter(name: "Laura Roslin")
let adama = TVCharacter(name: "William Adama", yearsActive: 45) Above, struct TVCharacter {
let name: String
let yearsActive: Int?
}
let starbuck = TVCharacter(name: "Kara Thrace", yearsActive: null) Once the struct is fully constructed with all the values set in Swift, only then is it sent over the FFI. The only confusion in my mind is this: what happens when we specify a field that is
I don't know which of these are the least bad. @linacambridge @rfk @tarikeshaq ? thoughts? |
This makes sense to me, thanks for writing it out so clearly. I favour this option in the short term:
If only because it's easy to change in a backwards-compatible way later. I also think it's worth taking a step back and asking ourselves: this requirement comes from mozilla/application-services#3440 where we have a dictionary with a tonne of optional fields, but is "optional fields" really the abstraction we want here, or do we want the equivalent of a (I personally feel like having an enumerated set of known fields is probably the right thing, but I don't know much about how it will be used by the underlying rust code, and if we're just going to match on its fields as if it were a |
For
The Now that I think about it, the fields on For
I like this as well! I'm guessing we'd specify default values on the IDL? |
#283 does the hard work of implementing literals. This should be relatively simple now: most of the work here is in testing in |
Based on the discussion in mozilla/application-services#3440
We need a clear story on how we represent optional fields in dictionaries.
A few things from that discussion:
nullable
?I Haven't looked at the details here, but opening this for further discussion in this repo
┆Issue is synchronized with this Jira Task
The text was updated successfully, but these errors were encountered: