-
Notifications
You must be signed in to change notification settings - Fork 6
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
Weak tables #15
Comments
Once you have a |
I took a brief look at |
I prefer the latter as it avoids conditionally depending on yet another library, what do you think @vleni ? |
I think giving access to the weak pointer inside would be a good idea. The |
How is this intended to be used? I tried combining the let mut table = <WeakKeyHashMap<Weak<ActualTerm>, u32>>::new();
let one = var(1);
table.insert(one.to_weak_ref().upgrade().unwrap(), 1); // yuck
assert_eq!(table.get(&one), Some(&1)); but this seems wrong/redundant. |
Hi @asvarga! Sorry for the delay. I'm not sure how this is intended to be used as I don't use However, looking at Then you could just write let mut table = <WeakKeyHashMap<Weak<ActualTerm>, u32>>::new();
let one = var(1);
table.insert(one.to_ref(), 1); // better (?)
assert_eq!(table.get(&one), Some(&1)); Am I making sense, am I missing something? Do you think that would be fine? |
Thanks for your response, I kept wanting to do table.insert(one.elm, 1); but |
Sounds good, I'll merge that ASAP, thank you for your feedback 😺 |
Is there a way to use
WHConsed
as keys in a weak hash table like weak_table? If not I can write one and open a PRThe text was updated successfully, but these errors were encountered: