-
Notifications
You must be signed in to change notification settings - Fork 185
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
#[derive(ULE, VarULE)]` could be more useful for simple wrapper types #2310
Comments
Just to offer some data here. Here's a full inventory of the VarULE types in ICU4X, excluding tests and benches:
Therefore, we have 3 cases that are good Both buckets span generalizable zerovec types (StrStrPairVarULE, UnvalidatedStr) and custom client types (PatternULE, NormalizedPropertyName). Therefore, I think it's not a correct characterization to describe the second bucket as "a small use case". I think it's a use case that is just as valid and practical. The second bucket are simply types for which we don't need the non-ULE type, because the ULE type does the whole job. This means simply any type that is already unaligned. We shouldn't make such types second-class; they're the ones that work best with ZeroVec's architecture. They may be more efficient, too, because we don't need to calculate lengths and pointers to fill in |
Yeah I think when I filed this issue it felt small, but for VarULE specifically I don't think it is anymore. (For ULE it's almost always the case that having the AsULE is good, but I think there's room for support for reflexive AsULEs) One thing we could do is make this |
|
In #5124 we're also discussing finding a way to avoid these derives and using macros instead. Looking at the codebase, I see a bunch of similar but distinct use cases:
|
Moving that discussion to #5127 |
In general we nudge people towards
#[make_ule]
and#[make_varule]
, but there is a small use case for the direct derives: when you're making a simple wrapper type around an existing ULE or VarULE type.It would be nice if
#[derive(ULE)]
could be asked to generateAsULE
andZeroMapKV
implementations, and#[derive(VarULE)]
could be asked to generateSerialize
,Ord
(etc), andZeroMapKV
The text was updated successfully, but these errors were encountered: