Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
gus_massa
2y ago
0 comments
Share
Sorry if I got the syntax wrong, but in something like
f = { x = (list 1 2 3) y = (list x x) z = (get x 1) <- y }
How does the compiler decides if it must free the memory used by x?
0 comments
default
newest
oldest
s_Hogg
2y ago
All lists are passed by value and X isn't the return value, would be my guess
_a_a_a_
2y ago
It's an interpreter rather than a compiler, and looking at the code it seems to use ref counting
gus_massa
OP
2y ago
Ref counting makes a lot of sense with the description of the OP, and if there are no cycles it's good.
yeputons
2y ago
It should. Everything is copied and by-value, there are no references/pointers or even closures, cycles are impossible. Think Pascal that has garbage collection for strings and dynamic arrays.
j
/
k
navigate · click thread line to collapse