-
Notifications
You must be signed in to change notification settings - Fork 13
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
Remove Clone bound from more things #72
Comments
There are a few things I don't quite understand. I guess the most important one is: why is it worth the effort? You can't really do much with an I also didn't understand how the proposed implementation would work. Presumably, |
I don't know if it's worth ^^
Why do you presume that? It would have to support that. |
Great, so let me play the role of the grumpy maintainer that wants to minimize effort (but of course feel free to push back). First of all, one easy way to drop the
If supporting this in impl requires duplicating everything, I'd argue it's easier to fix those proc macros instead. Deriving conditional on bounds is useful enough that they'd probably have applications other than imbl.
Without an example of such code it's hard to be sure, but if it only reads from the container why bother putting an
I'm not sure, I think I misunderstood the proposed implementation before. If I understood it correctly now, the idea is that every time an Anyway, having just argued against including this, let me also suggest some possible alternate implementations:
|
Thanks for the very detailed reply, makes a lot of sense. Having this kind of discussion is what I opened the issue for before putting too much effort into the implementation :) I'll only respond to some bits for now that I find most interesting, and will get back to the usefulness of this feature later (in short, I think you're probably right that it doesn't pull its own weight).
Yes, exactly!
This is actually the kind of thing I wanted to do at first, but since I'm much more comfortable with generics and weird memory management tricks like
I think this should be feasible. I'm personally not terribly interested in the I have a little bit of experience with GATs and a lot of experience with the trait system in general, and it would be a real fun puzzle to slot this all together. Three Qs about your idea for a GATified imbl:
|
In principle, sure, I don't have strong feeling either way. I think I'd probably want to see some measurable benefit (e.g. some speedup in a benchmark) to justify the added dependency.
Sure, if the pool feature is getting in the way, feel free to rip it out.
Good question, and without knowing what the API looks like it's hard to say. Probably it would make sense to expose the GATs for flexibility, and if they're particularly annoying to use then maybe they could go in a submodule and there could be a simplified facade in the crate root? But if it's as simple as an extra defaultable generic parameter (like
I'm not too worried about breaking the API; it isn't exactly like we have a hard-to-keep-up-with release cadence here. But for ease-of-use I'd probably try to guess the main candidates for (a)rc replacements and provide support for them within imbl (behind feature flags if they require taking on additional dependencies). |
As a follow-up to #71, I would like to remove the
Clone
bound fromDeserialize
too. However, this requires a lot of other changes, so I'd like to discuss it here first.The solution I'm thinking of is to duplicate a large part of the current API internally to be able to add items to a container while knowing that no
Clone
is actually called (there might be an alternative around a#[repr(transparent)]
wrapper that implementsClone
for anything and always panics, but then it's really hard to ensure that that impl is never used). That is, use something likeUniqueArc
and buildUniqueVector
,UniqueRRB
,UniqueNode
and such on top of it. ThenFromIterator
can use that to drop itsClone
bound, andDeserialize
doesn't need theClone
bound either anymore.Wdyt?
The text was updated successfully, but these errors were encountered: