What is Nostr?
Capital /
npub1ryf…ur9z
2023-07-01 21:39:34

Capital on Nostr: I have finally ran into a unit test that test for behavior that Lua has but Crystal ...

I have finally ran into a unit test that test for behavior that Lua has but Crystal doesn't.

Lua has the concept of weak tables that allow the garbage collector to remove member from a table automatically. Crystal, however, has no such feature.

You can make a type like Hash(T, WeakRef(U)) in Crystal. And this hash-map will not persist the value referenced by WeakRef(U). However, unlike crystal, when a WeakRef(U) is empty, it is not removed from data structures.
Author Public Key
npub1ryfja06pvw3rnyv3hjgvy0en68lyj3wta8yq0vx3j6ch9gnsr9ss2wur9z