Closed dzmitry-lahoda closed 5 years ago
I'm not sure about what you are saying here. Care to clarify/expand?
There is new design in C#(thanks to all ref
suff and Unsafe
). In this design it is possible to manage memory manually and pass by ref
. But ref cannot be stored without copy. So I want to have index to Memory
(or array or circular buffer) stored behind IRefApply
call(which is struct) to avoid delegate
overhead. Box also struct to avoid overhead and because struct cannot have ref
into fields I need ref into manually managed memory. So there should be another ref like Box to state boxing any value
. Because I cannot box large structures in sane manner.
I consider Ref.Scala
to be a box of some kind. Could Interlocker
be named as AtomicBox
or like? Could AtomicBox
be structure? To have common name pattern? Also it could use some GC allocated object imlementing IRefApply
to get ref. Or (if works), as it stores only value it could Unsafe cast it into itself and pass self as ref. So Interlocker maybe can be struct.
Mark as readonly, I guess it is right for designs. Will not hurt? Right?
What is API fox boxes? Any other boxes to have, so interface?
Box<T< : IBox<out T>
IRefBox
as for ref return.5. Mark as readonly, I guess it is right for designs. Will not hurt? Right?
This is done in ee4c0aeebd9d6db5be828b948cab444ae05db732. However, with respect to the rest, I am completely lost as to what you are asking or suggesting even when I re-read months later. I will close this issue now but happy to re-open if you can provide more clarity. Thanks.
Box<T> : IBox<T>
readonly struct Box<T>
RefBox
https://github.com/scalaz/scalaz-zio/blob/master/core/shared/src/main/scala/scalaz/zio/Ref.scala ?Interlocker
? Whyclass Interlocker
? Why not struct?public ref T Value = ref valueRef.Invoke();