Better HN
topnewbestaskshowjobs
Log inSign up

flafoar

2 karma · joined Aug 6, 2017 (9y ago) · 2 submissions

Submissions

comment 9y ago · link · parent

Yes, the way I was looking at strong/weak references was that strong references could only be held as a value in local/global/class variables, including in lists and dictionaries.

And converting a strong reference to a string would give you a weak reference. So you wouldn't be able to, say, convert a list that included a strong reference to a string, then convert the string back to list, and have exactly the same list that you started with because the strong reference in the original list would be a weak reference in the resulting list.

Strings can represent list and dictionary data structures, and combinations of, but I'm not sure that strings represent all Tcl data structures in the same way. I'm thinking of Tcloo and Tcl arrays - I don't use those and know little about them.

comment 9y ago · link · parent

I don't really have much of a need for garbage collection, but I did investigate strong/weak references (which I would probably prefer over garbage collection). See http://wiki.tcl.tk/41605. That's the best I could do with my limited knowledge of the Tcl internals. My suspicion at the time was that if the Tcl core team really wanted to implement strong/weak references, then they would probably be able to come up with a proper way of doing that. And if they could do that they could do garbage collection. But I don't really know ...