So ... I was trying to read up on `=sink` and `=destroy`, and am a bit confused:

There's 
[https://github.com/nim-lang/Nim/wiki/Destructors](https://github.com/nim-lang/Nim/wiki/Destructors)
 , which appears to be outdated, forwarding to 
[https://github.com/nim-lang/Nim/wiki/Destructors,-2nd-edition](https://github.com/nim-lang/Nim/wiki/Destructors,-2nd-edition)
 which refers to 
[https://github.com/nim-lang/Nim/blob/devel/doc/destructors.rst](https://github.com/nim-lang/Nim/blob/devel/doc/destructors.rst)
 which does not document which version it actually references.

Also, the latest destructors doc refers to `lent` and `owned` references which 
are only documented there and not in the 1.0.0 language manual, and you mention 
the "old default `seq` implementation" which fails to call `=destroy`, implying 
that there's a new one? (but how do I choose which one is used?)

I would like to implement a "functional" copy-on-write refcounted sequence 
(a-la APL / J / K / Ocaml without references), that is - the semantics of every 
value of this kind is equivalent to a value type, and thus can have no cycles 
-- much like refcounted strings. (so .. refcount is precise)

Araq, hopefully this is not too much to ask - but, what would you recommend as 
an implementation strategy? My idea would be own-managed ptrs to memory, and 
using the `=`,``=sink``,``=destroy``, `[]=` operators to manage the references. 
It seems like `sink`, `owned` and `lent` may help with removing unneeded refcnt 
operations in some places, but since they are not in the 1.0.0 manual I am at 
loss about whether they can be relied on to be there, and/or which gc model 
they assume/require.

Thanks in advance.

Reply via email to