Skip to content

Weak collections#406

Merged
Perryvw merged 3 commits intoTypeScriptToLua:masterfrom
ark120202:weak-collections
Feb 15, 2019
Merged

Weak collections#406
Perryvw merged 3 commits intoTypeScriptToLua:masterfrom
ark120202:weak-collections

Conversation

@ark120202
Copy link
Copy Markdown
Contributor

Tests don't check weak part, because Fengari not supports it.

Copy link
Copy Markdown
Collaborator

@tomblind tomblind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test to verify "weakness"? Something like this should work:

declare function collectgarbage(): void;
const wm = new WeakMap<{}, boolean>();
let a: {} | undefined = {};
wm.set(a, true);
a = undefined;
collectgarbage();
return wm.has(a);

@ark120202
Copy link
Copy Markdown
Contributor Author

@tomblind not unless it would be runned on real Lua VM, Fengari not implements gc.

Copy link
Copy Markdown
Collaborator

@tomblind tomblind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. It might be possible to do gc at the node.js level, but I'm not really sure how that could be set up.

@Perryvw Perryvw merged commit a246177 into TypeScriptToLua:master Feb 15, 2019
@ark120202 ark120202 deleted the weak-collections branch November 26, 2019 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants