-
Notifications
You must be signed in to change notification settings - Fork 174
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
Create wrapper object for ScriptExtensions array return value #1536
Comments
Could this simplify the implementation? For example, for a character that has no Script_Extensions, it could copy the Script value into the return value, rather than having to treat the trie data array element as a Script array slice. This then also frees the trie encoding from having to store a non-scx value as a Script with no extra bits. (This is currently the case, but it could prevent future extensions of what is stored in the trie.) |
Yeah, what Markus describes is an example of the second bullet under "pros", which is that we have more control over the implementation if we change it in the future. We're not locking ourselves into having a ZeroSlice for all cases. |
The thing that gives us the ultimate amount of flexibility actually is to return an iterator, like you're working on doing for the other case (script-to-cp-range). |
There are two operations you may want from the return value:
(1) can be done with an iterator. (2) is more efficient with the ZeroSlice since you can binary search in it. These two operations could perhaps be separate methods on ScriptExtensions. But, they could also be a single method, returning a struct that implements |
The more I think about this the more I think we should probably go ahead and wrap the ZeroSlice. This issue has no triage labels. @echeran Are you happy with this conclusion, or do you want more input? |
@snktd may be interested in this. |
…1990) * Create wrapper object for ScriptExtensions array return value #1536 * #1536 Create wrapper object for ScriptExtensions array return value * Resolving a minor issue with code comments. * Update components/properties/src/script.rs Co-authored-by: Shane F. Carr <shane@unicode.org> * Addressing review comments. * Making ScriptExtensionsSet.values private * Addressing a minor review comment. Co-authored-by: Shane F. Carr <shane@unicode.org>
…-org#1536 (unicode-org#1990) * Create wrapper object for ScriptExtensions array return value unicode-org#1536 * unicode-org#1536 Create wrapper object for ScriptExtensions array return value * Resolving a minor issue with code comments. * Update components/properties/src/script.rs Co-authored-by: Shane F. Carr <shane@unicode.org> * Addressing review comments. * Making ScriptExtensionsSet.values private * Addressing a minor review comment. Co-authored-by: Shane F. Carr <shane@unicode.org>
This issue is spun off from a previous discussion.
The question is whether, when returning the Script_Extensions property value for a code point, which is an array of Script values represented as a
ZeroSlice<Script>
, it would be better to wrap theZeroSlice<Script>
return value in an object that can allow specific extra functionality (ex: helper methods) added to it.This seems somewhat reminiscent of #1239 which regards returning Unicode property data in terms of interfaces rather than hard-coding concrete data structures.
Pros & cons identified so far:
Pros:
Cons:
@iainireland @sffc
The text was updated successfully, but these errors were encountered: