-
Notifications
You must be signed in to change notification settings - Fork 176
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
Organize properties code to be more like the other crates (get rid of free functions) #3573
Comments
Discuss with: Optional: |
Proposal: CodePointSetData/etc get All of these are added on CodePointSetData even if they return CPSDataBorrowed We can alternatively or additionally add: |
March 11, 2024 (manish and robert talk about FFI)
Proposals:
icu_properties:
Con: free functions still not super idiomatic for this kind of thing, but not as bad
icu_properties:
Con: we kinda have a useless zero sized type here, also not idiomatic Rust when you just want to dangle methods
Pro: no need to have five billion methods and we can do any/buffer/whatever ctors without exploding the API size Decision: per-property ZST approach (3) Agreed: @Manishearth, @robertbastian, @echeran @sffc was present for part of the discussion and hasn't seen the final agreement, may further discuss |
@sffc was a bit lukewarm on the marker types originally because he didn't want to have divergence between FFI and Rust, but we already have significant divergence here because of the free functions He's happy with the per-property ZST approach, however. We can be more careful in FFI docs to help people comparing FFI and Rust. @robertbastian noted that the BinaryProperty trait may need to be sealed with some hidden methods. |
I like the marker type approach; but can we be more explicit about how we specify the marker types? For example, we already have |
@sffc that was the "open question: do we use marker types or just the value type for enum properties" Personally I think we should use the value type for the enum properties, the only potential downside is if we want to reuse them; but they're "open enum" newtypes anyway so i don't think there's a huge case for reuse. naming can get tricky, are we going to have the binary properties called |
CodePointSetData::<Alnum>::load() which would allow a client to ask for a type
Proposal:
LGTM: @sffc @Manishearth @robertbastian @echeran (@hsivonen) |
@robertbastian may have code for this otherwise i can work on it |
I think this was done by #5548? |
This is probably a 2.0 change (#2856)
The properties code uses a lot of free functions for loading property maps and such, rather than using constructors on
CodePointSetData
andCodePointMapData
as would be tradition in the other crates.This makes things a bit awkward. We should consider this design again for 2.0.
Some open questions:
CodePointMapData<GeneralCategory>
(etc) whereas FFI uses an erased version?To-do items:
load_
instead ofget_
cc @robertbastian @sffc
Low-priority discussion since it's likely a 2.0 issue.
The text was updated successfully, but these errors were encountered: